I have a structure like so:
"games" : {
"03e46939-af4e-4b9a-ba3b-99132f0bf34d" : {
"1P0mWbp1jYOayaMEyQcnKvX4YB63" : {
"logs" : {
"-LDxpYtVZJc4LmJmyzn1" : {
"guess" : "1234",
"result" : "1P 1B",
"score" : 150
}
},
"maxbulls" : 1,
"maxpigs" : 1,
"moves" : 1,
"profilepicture" : "bull.png",
"score" : 150,
"username" : "user1p0mw"
},
"5AvSPiyH3faqw1P7inHdyjV6noC2" : {
"maxbulls" : 0,
"maxpigs" : 0,
"moves" : 0,
"profilepicture" : "pig.png",
"score" : 0,
"username" : "user5avsp"
},
"answer" : "8103e4693964",
"id" : "03e46939-af4e-4b9a-ba3b-99132f0bf34d",
"requestor" : "1P0mWbp1jYOayaMEyQcnKvX4YB63",
"status" : "pending",
"turn" : ""
},
"21b1451-rf45-4b9a-ba3b-99132fgoe856" : {
"5AvSPiyH3faqw1P7inHdyjV6noC2" : {
"logs" : {
"-LSwzYtVZJp9s6gmuw7n" : {
"guess" : "1234",
"result" : "1P 1B",
"score" : 150
}
},
"maxbulls" : 1,
"maxpigs" : 1,
"moves" : 1,
"profilepicture" : "pig.png",
"score" : 150,
"username" : "user5avsp"
},
"answer" : "8103e4693964",
"id" : "21b1451-rf45-4b9a-ba3b-99132fgoe856",
"requestor" : "5AvSPiyH3faqw1P7inHdyjV6noC2",
"status" : "pending",
"turn" : ""
}
}
Where there are many games with unique GUIDs and containing keys of 1-2 UIDs. I want to get all games where 5AvSPiyH3faqw1P7inHdyjV6noC2
is a child of a game. I do not know the game ID(s) at the time of the query.
I have tried this.afDatabase.list('/games/', ref => ref.orderByChild(user.uid))
which results in ALL games being pulled in. EDIT: No matter what UID is passed in. I realized this example was bad because in this case I would want all games returned.
And this.afDatabase.list('/games/', ref => ref.orderByChild(user.uid).equalTo(user.uid))
which pulls in no games.
And this.afDatabase.list('/games/', ref => ref.orderByChild().equalTo(user.uid))
which throws an error about orderByChild
not having any arguments passed in.