Vor Name
Vor Name

Reputation: 221

Firebase Query Chaining?


How would a Query, where I want to check if a Person Already Created a (not Running)Game look like?
I know how to make a simple Query, but it isn't possible to chain Query's right?

const-ID = "some id"

if(creator.displayName == const-ID && state == 1) return true
else return false

enter image description here

Upvotes: 1

Views: 909

Answers (1)

cutiko
cutiko

Reputation: 10517

You dont need to nest the creator inside the game, instead displayName and uid should be direct childs of the game.

Then you still have the problem because you want 2 search criteria. Sadly you cant do that in Firebase, yet. But what you can do is to generate another node inside the game called "state_uid". And then, query like child("games").orderByChild("state_uid").equalsTo("1_"+uid);

Look at this Firebase video https://youtu.be/sKFLI5FOOHs

Upvotes: 2

Related Questions