3
以下是我的Firebase數據庫結構和我的查詢。Firebase索引動態值警告
而且我對這種結構的查詢是:
var messageRef = databaseRef.child(`/messagesThread/-KdzCvVW5icW7ZuSIAxV`);
messageRef.orderByChild(`/readBy/{userId}`).equalTo(false).on("child_added", (snapshots)=>{
console.log("Unread messages = " + snapshots.numChildren());
});
但上面的查詢給我的警告作爲
FIREBASE WARNING: Using an unspecified index. Consider adding ".indexOn": "readBy/{userId}".
因此,如何增加這個indexOn動態{userId}
?
是啊。另請參閱我的答案在這裏更長的解釋:http://stackoverflow.com/questions/40656589/firebase-query-if-child-of-child-contains-a-value –
謝謝你們兩個! –