Reputation: 223
{
43268jfjn7983-347983:
{
title: 'hello world',
time: '1000'
}
}
As above, I just want to update 43268jfjn7983-347983
to something else, is this possible in firebase?
Upvotes: 18
Views: 12850
Reputation: 598765
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();
});
Upvotes: 29
Reputation: 7
If it concerns debugging purpose, it can easily be done through the firebase realtime database console.
Export the JSON file of your database by clicking on the settings icon and then on "Export JSON".
Open it in a simple text editor, apply the required modifications and save it.
In the realtime database console click on the same settings icon and then click on "Import JSON".
CAVEAT: Importing a JSON file overwrites the whole database.
Upvotes: -2