Firestore "Get Document by ID" query success but query.data is null

Hello,

I'm trying Retool for creating firestore admin panel. When I use "Get Document by ID" to fetch document from a collection, the query was successfully finished but query.data was null.
I could use query.data when I use "Query Firestore" for same collection.

How can I access the data fetched with "Get Document by ID" query ?

The attachment is screenshot of the query and the result.

Hi @nakamura! When you “preview” the query with the blue “play” arrow here, it won’t update the .data property of the query itself. Can you try triggering the query with another component (I.e. a button), or another query?

We’re working on clarifying that workflow now, and making it easier to preview vs run a query now!

1 Like

Hi @alex-w !
Thank for your reply. I have tried to trigger the query with "On click" of a Button, then it successfully worked.
Thank you very much for your advice :pray:

Can you try triggering the query with another component (I.e. a button), or another query?

It works, but how can I run firestore queries automatically?

In the query editor (bottom middle panel of the editor) You can set a query to be either run when “inputs change” or when “manually triggered”. If a query is set to run when inputs change is will run whenever the value of a {{ }} tag updates the query will run and update it’s .data property. Does that work?