1
votes

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

  • User1-User2
  • User1-User3
  • User2-User4
  • User4-User1

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

Is it possible to do it?

2

2 Answers

0
votes

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.

0
votes

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! :)