1


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

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

4 Comments

hello, i already safed the whole playlist hehe<br> after watching this video from an google dev. <br> youtube.com/watch?v=8wF-mKMsynE <br> i nested the information just like he did, but will change that soon thanks!
if i do soemthing like this: pastebin.com/raw/mT9v76Lf its printing 1 and 2 and the function isnt working what am i doing wrong?
Well, you the nesting rule is, nest as less as you can and don't transfer unnecesary data, in this case it could be acceptable.
There is nothing wrong with the query. The once method is a promise therefore it will resolve asynchronously. That mean any code below will also be executed since the promise is being processed in "paralel".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.