I'm trying to write data to the Firebase Database with a given Priority, in order to then retrieve the childs in reversed order than they are currently in. The following I got from the answer of another question regarding this issue:
var postData = {
url: urlvar
};
// Get a key for a new Post.
var newPostKey = firebase.database().ref().push();//.key;
newPostKey.setWithPriority(postData, 0 - Date.now());
var updates = {};
updates['/user-posts/' + uid + '/' + '/urls/' + newPostKey] = postData;
return firebase.database().ref().update(updates);
However, when trying to trigger this, I'm getting (from the extensions popup console):
Error: Firebase.update failed: First argument contains an invalid key
Which argument is meant by that, what exactly is wrong here?
What did work, before I tried to set a priority, was simply the code above but newPostKey was attached a key:
var newPostKey = firebase.database().ref().push().key;