Yowims
Yowims

Reputation: 150

Get all documents where document ID contains my string

I have a Firebase collection, and my documents ID are like this :

In my Flutter app, I want to get only the documents where the document ID contains "User1".

Is it possible to do it?

Upvotes: 1

Views: 733

Answers (2)

Yowims
Yowims

Reputation: 150

I finally decided to use Algolia, which is an external service allowing to do what I wanted to do. It's really easy to use and really practical ^^ I posted samples of my data into Algolia, and the research worked perfectly ^^

Thank you for your help! :)

Upvotes: 0

Frank van Puffelen
Frank van Puffelen

Reputation: 600006

While it is possible to search for documents where the ID starts with a certain value, it is not possible to search for document IDs that contain a certain value.

If you need this functionality, the typical solution is to create an additional collection where you map the user ID to the relevant document IDs.

Upvotes: 1

Related Questions