我想在其ID上更新基於Firebase的帖子。 所以我有地方存放這樣無法通過推送ID引用Firebase數據
var postID = -xyz1234567;
firebase.database().ref('posts').child(postID).update({
blah: "blah",
foo: 'bar'
})
一個變量,但我不斷收到此錯誤,說;
Error: Firebase.child failed: First argument was an invalid path: "undefined". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"
凡'postID'關於你的實際代碼的更新?看起來像'postID'不在同一個範圍內。 – Bert
這看起來像一個語法錯誤'var postID = -xyz1234567;'而不是組成您認爲'postID'的示例代碼,發佈[最小的實際編譯代碼,再現問題](http://stackoverflow.com /幫助/ MCVE)。 –