Best answer

How do I write a Firestore query to select a single record by Doc ID?

  • 15 August 2023
  • 2 replies
  • 169 views

Userlevel 1
Badge

Hi, I´m looking for an example of a firestore query to select a single record.  I know the doc ID I want to select.

Please only real examples, and no suggestions to read the documentation - its “poor” (being really polite).  

 


"where": { "fieldFilter": { "field": { "fieldPath": "__name__" }, "op": "EQUAL", "value": { "referenceValue": "projects/adventure-hunt-323xxx/databases/(default)/documents/CollectionName/xxxxxxxxxxx } } },

 

xxxxxxxxxxxx is the value I want to search for.

icon

Best answer by Tenerifekiwi 15 August 2023, 18:07

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 1
Badge

Solved.  By removing the orderby part of the query it worked fine.

Userlevel 7
Badge +11

Thanks so much for circling back to share your solution here, @Tenerifekiwi! I’m sure it’ll be helpful to a lot of folks in Community that might be facing the same issue. 🤗