0

I've got currently one collection called restaurants and each document in it has an owner (string) and a workers (string[]) fields.

Is there any way I can make an OR operation requesting the owner field to be an uid or the workers field containing the uid. Something like this:

document.owner === UID || UID in document.workers

I hope there's a way to solve this without making 2 different read operations.

Thanks for replying and please, ask me if I haven't explained my problem well.

  • Firestore does not support that type of logical OR query. It would require two queries, and merging the results in the client. – Doug Stevenson Oct 07 '20 at 19:50
  • Okey, thanks for answering as fast and for clarifying this doubt – Daniel Mateos Oct 07 '20 at 19:53
  • @DanielMateos You may be interested by this article: https://medium.com/firebase-tips-tricks/how-to-combined-two-firestore-queries-to-simulate-a-logical-or-query-27d28a43cb2d – Renaud Tarnec Oct 08 '20 at 07:54

0 Answers0