Skip to content Skip to sidebar Skip to footer

Querying At Firebase Not Working With Orderbychild/equalto With A String Child Field

I really don't get this and, once more, am close to desperation dealing with firebase.. I have a list saved at a specific location: root/Chats/WPXEmqvX1BfQB9n3UQFjF3xi1so2 'Cha

Solution 1:

Just do

rootRef.child("Chats") .orderByChild("uid").equalTo("Jc9dASQdabXiT0holYFDkeqCczK2") .addListenerForSingleValueEvent

This query, for all children in the "Chats" node, will order them by "uid", and returns the one with the right uid value. I think the query before did not work for you because you explicitly specify which child in chat using .child("WPXEmqvX1BfQB9n3UQFjF3xi1so2"), which returns you the child with the key "WPXEmqvX1BfQB9n3UQFjF3xi1so2" (which is one single chat object), so orderByChild("uid") does not work like it's supposed to anymore.

Solution 2:

When you are holding particular node you can't update the same node. Why because it's still in use and holding reference.

Post a Comment for "Querying At Firebase Not Working With Orderbychild/equalto With A String Child Field"