1
'child_added'工作正常,但'child_removed'不起作用。Firebase'child_removed'事件侦听器不工作
数据索引是“.indexOn”:“status”。
火力地堡数据
{ "user uid" : { "-Kb8FSBMOvcposJ-iJYL" : { "createDate" : 1485140252291, "message" : "login", "response" : "none", "status" : "0", "title" : "8. sign-in" }, "-KbL6d1xrfqCBAcP7_Qu" : { "createDate" : 1485356045006, "message" : "logout", "response" : "none", "status" : "1", "title" : "sign-out" } } }
火力地堡事件侦听器
var notiRef = firebase.database().ref('message/' + user.uid); notiRef.orderByChild('status').equalTo('wait').on('child_added', function(snapshot) { //do something... }); notiRef.orderByChild('status').equalTo('wait').on('child_moved', function(snapshot) { // not worked. }); firebase.database().ref('notification/' + user.uid + '/uid').on('child_moved', function(snapshot) { // not worked. }); notiRef.on('child_moved', function(snapshot) { // not worked. });
所有这三个在上面的代码 'child_removed' 将无法正常工作。 设置ref目标是否存在问题?或者它是否与设置indexOn有关? (设置indexOn是必需的)
这是我的错误。 思想被“移除”,但打字被“移动”。 谢谢。 – user7354286