April 2018
Intermediate to advanced
284 pages
6h 43m
English
In Firebase Realtime Database, all data is stored as JSON objects, which is a cloud-hosted JSON tree. When we add data to the database, it becomes a node in the existing JSON structure with an associated key, which is autogenerated by Firebase. We can also provide our own custom keys, such as user IDs or any semantic names, or they can be provided using the push() method.
For example, in our Helpdesk Application, we are storing the tickets at a path, such as /helpdesk/tickets; now we'll replace this with /helpdesk/tickets/$uid/$ticketKey. Take a look at the following code:
var newTicketKey = firebase.database().ref('/helpdesk').child('tickets').push().key; // Write the new ticket data simultaneously in ...