As a newbie in firebase I tried to mimic a kind of "where clause" request to retrieve the user's wallet in this simple use case:
User
48bde8f8-3b66-40bc-b988-566ccc77335c
email: "toto@acme.com"
username: "userTest1"
UserWallet
F4PvtvNT2Z
coins: 26
someList
elemet1
elemet2
user: "48bde8f8-3b66-40bc-b988-566ccc77335c"
First I tried to code my request like this:
Firebase root = new Firebase("https://myApp.firebaseio.com/");
Firebase ref = root.child("UserWallet");
Query query = ref.equalTo("48bde8f8-3b66-40bc-b988-566ccc77335c", "user");
The result was null, So I wrote this query:
Query query = ref.orderByChild("user").equalTo("48bde8f8-3b66-40bc-b988-566ccc77335c", "user");
Result was null again. The only way to retrieve the wallet was with this query:
Query query = ref.orderByChild("user").equalTo("48bde8f8-3b66-40bc-b988-566ccc77335c");
So Should I have to always use en "orderByChild()" query before to use "equalTo()"?
And so, what is the purpose of the query "equalTo(String value, String key)" compare to "equalTo(String value) since only the second one works correctly?