Structuring Firebase


Firebase database is a schemaless database in which the data is stored as JSON objects. Basically the entire database is a cloud-hosted JSON tree with multiple nodes. When you add data to the JSON tree, it becomes a node in the existing JSON structure with an associated key.
  • The [ (square bracket) represents the JSON array. A JSON array can have values and objects.
In the sample code, a new user node will be inserted into database with a unique key value.

In general, the user ID should be acquired by implementing Firebase authentication in your app which gives you authID that acts as user ID. For example, consider a chat application that allows users to store a basic profile and contact list. A typical user profile is located at a path, such as /users/$uid. The user alovelace might have a database entry that looks something like this:
 {
   "users": [
     "-MVFliieHpmdMFHzKFim" : {
       "email": "mario@gmail.com",
       "name": "Super Mario"
     }
   ]
 }

 {
   "users": {
     "alovelace": {
       "name": "Ada Lovelace",
       "contacts": { "ghopper": true },
     },
     "ghopper": { ... },
     "eclarke": { ... }
   }
 }




      Wait until you try the new Yamaha scooters.    
      They will knock your socks off (amaze you)!.