Skip to content Skip to sidebar Skip to footer

How Can A New Data Be Added To Firebase Without The Post Keys?

I use the following code to add new data to firebase. var postData = { NSN: NSN, ProductName: ProductName, AssociatedContractNumber: Associate

Solution 1:

Just use push()

Say if you had and NSN object like

var NSN = { ... }
firebase.database().ref().child('Posts').push(NSN);

Doing this will always push the item to the end of your NSN array and firebase will take care creating unique key at the time of pushing.

Remember firebase don't know about arrays it only knows about objects.

Post a Comment for "How Can A New Data Be Added To Firebase Without The Post Keys?"