Firestore query doesn't work

42 views
Skip to first unread message

Fonzane Delungini

unread,
Feb 8, 2019, 11:50:19 PM2/8/19
to Firebase Google Group
Hi everyone :)

Can somebody help me explain why the firestore query method doesn't work for me?

I'm actually trying to get the example from the documentation to work.

But no matter what I do, even if I search for a non existing string, I get the same result (the object that can be seen on the picture I attached).

Someone told me that I have to use the .get() method, but I still don't understand why I get the result I attached and not the supposed result as written in the documentation.

Please help.

Kind regards,
Fonzane
queryCode.PNG
queryResult.PNG

Kato Richardson

unread,
Feb 9, 2019, 1:05:54 PM2/9/19
to Firebase Google Group
Hi Fonzane,

You've got off to a good start. But what you have here is a reference to a query, not a subscription that actually reads the data. So you just need to follow the rest of the guide on reading data, specifically you either need to do get() or onSnapshot() to fetch the data. 

Keep in mind those are asynchronous, so you'll need to follow the examples closely and only call your console.log() in the .then() method once the data is returned.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/7f5c3390-76fd-4553-af41-43816bf6c678%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Jeremy Sistrunk

unread,
Feb 9, 2019, 8:27:29 PM2/9/19
to fireba...@googlegroups.com
Take a look at how the observables work, make an observable, then subscribe to it like, .valueChanges().subscribe(Val => condole.log(Val)

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages