Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Query collection by document id

I am looking for a way to query by the document id instead of a field.

It might look something like that:

Firestore.instance.collection('tournaments').where(documentId, searchInput)

In this case searchInput is an incomplete documentId.

I saw a solution on Stackoverflow, but it isn't for flutter: https://stackoverflow.com/a/52252264/8539070

Another thing to keep in mind is that I am trying to display a list of all documents in a collection that match some part of the id.

Thank you for your help!

like image 402
jonasxd360 Avatar asked Dec 11 '22 02:12

jonasxd360


1 Answers

You can also get several documents by their id using:

Firestore.instance.collection('tournaments')..where(FieldPath.documentId, whereIn: myIdList).snapshots()

where myIdList is a List

Enjoy

like image 189
NetCob Avatar answered Jan 18 '23 01:01

NetCob