{
43268jfjn7983-347983:
{
title: 'hello world',
time: '1000'
}
}
As above, I just want to update 43268jfjn7983-347983
to something else, is this possible in firebase?
Firebase automatically creates API keys for your project when you do any of the following: Create a Firebase project > Browser key auto-created. Create a Firebase Apple App > iOS key auto-created. Create a Firebase Android App > Android key auto-created.
In Firebase Database everything is a node, that follows the pattern key: value. Firebase Database provides us with a simple way to generate unique keys. Unique keys create new items while uploading data to a previously stored key will update.
For updating a single node in our JSON database, we simply use setValue() on the correct child reference.
In the Firebase console, open Settings > Service Accounts. Click Generate New Private Key, then confirm by clicking Generate Key.
There is no way to change the key of an existing node.
So instead I'd go for:
var ref = new Firebase('https://my.firebaseio.com/');
var child = ref.child('43268jfjn7983-347983');
child.once('value', function(snapshot) {
ref.child('somethingElse').set(snapshot.val());
child.remove();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With