I want to save a firebase-document
to Firebase. But I encounter the following error.
Uncaught (in promise) Error: Firebase.push failed: first argument contains an invalid key ($key) in property 'xxxxxxxxxxxx.items'. Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"
Here is the relevant code.
my-element.html<firebase-document id="document" ... ></firebase document>
...
save: function() {
var doc = this.$.document;
console.log('Saved', doc.data);
return doc.save(this.itemsPath).then(function() {
console.log('Saved:', doc);
doc.reset();
}.bind(this));
return Promise.resolve();
},
The data object contains a key label containing the $
character. But this is automatically introduced by Firebase, not a programming decision.
Saved: {
$key: "foo" // This is the object key in Firebase
...
}
What edits can I make to save my data?