Here are my Firebase database structure and my query.
And my query on this structure is:
var messageRef = databaseRef.child(`/messagesThread/-KdzCvVW5icW7ZuSIAxV`);
messageRef.orderByChild(`/readBy/{userId}`).equalTo(false).on("child_added", (snapshots)=>{
console.log("Unread messages = " + snapshots.numChildren());
});
But above query giving me warning as
FIREBASE WARNING: Using an unspecified index. Consider adding ".indexOn": "readBy/{userId}".
So how to add this indexOn with dynamic {userId}
?