Create New Path In Firebase Realtime Database Programmatically?
In Firebase documentation I don't found the anweser. How to add a new path in real-time database programmatically in Javascript? Like (just an example): standard path: https://test
Solution 1:
Keys and paths in the Firebase Database are automatically created when you write a value to them. So to generate the path info/important/personal
, you would write a value under it. For example:
firebase.database().ref('info/important/personal').set(true);
This will generate the following JSON:
{"info":{"important":{"personal":true}}}
Note that the inverse is also true: Firebase will automatically remove empty keys/paths. So if you delete the true
above, the entire JSON will be deleted.
Post a Comment for "Create New Path In Firebase Realtime Database Programmatically?"