I am trying to get all users that have a certain listId in their contactLists object. My firebase realtime database structure is as follows:
user:
john:
contactLists:
-NIOsvb: true,
I have other users in the DB and I want to get all that have -NIOsvb in their contactLists object. This is the approach I tried (listId is passed as a parameter):
const snapshot = await get(query(ref(db, "users"), orderByChild("contactLists"), equalTo(listId)))
I expected to get all the user objects that have this id in their contactLists. However, the value of snapshot is null. Any suggestions would be appreciated, as I don't have a lot of experience with Firebase functions.