Next lesson playing in 5 seconds

  • Overview
  • Transcript

2.1 Firebase Data

Hello, everyone. This is Reggie Dawson. Welcome to the use firebase as your back in course for Tuts+. In this video, we're going to talk about firebase data. Firebase is desirable as a back end because it frees us from setting up a server to support our apps. In keeping with that, firebase use a no sequel database to store your data. In order to write to our database, we just have to create a reference to our Firebase app. Our Firebase data stored as a JSON object. When we add data it becomes a key in the existing JSON data. In our app, we're going to create a child node called products where we'll save our product listings. Therefore in order to access the products we would have to use this path. We will talk more about children nodes and how to save to them in the next video. We will also look at the data in the dashboard to better understand the structure of the Firebase data. Another thing to understand is that Firebase does not have support for a raise. Although we can send data to Firebase as an array the JavaScript Client will save it as an object. So if we send in array such as this, Firebase will actually save an object. Fortunately Firebase includes methods that will return our data as array, but it is important to understand this especially if you are getting the data back that you expects. Lastly it is suggested that use a flattened data structure. What this means is that data is arranged in such a way that we don't have to download all of our data to get information. For example we are building a catalog of products that will allow authorized users to add, update and delete products. If the user is just going to our site to buy a product they do not need to download any user information. As a result well create separate child nodes name users were authorized user logons could be stored with the at we build this will be the cases who use firebase authentication. But if we were creating something like a social media app with a lot of information shared across users we would definitely need to flatten our data in order for our app to run efficiently. We will better understand the data structure as we build our app. In the next video, we will get started by setting up our app and saving data to Firebase.

Back to the top