0

I am stuck onto simple problem. I have collection with docs in firestore. Each doc contains some fields and one of the fields is an array, that stores id's of all users who already seen that doc (the function is that each doc refers to a question, so that array stores id's of those, who already answered it).

enter image description here

In my query a need to get only those docs (questions), where the current user id is not stored in the field array.

I know that firestore provides us with func: collection.where('usersAnswered', arrayContains: _uid).limit(1).get();

But I need the exact opposite, something like arrayNotContains. Is there some way, or what would be the best solution to this?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Jan Smitka
  • 109
  • 3
  • This has been discussed a few times before, so did you already have a look at those? https://stackoverflow.com/search?q=%5Bgoogle-cloud-firestore%5D+array+not+contains – Frank van Puffelen Jun 20 '21 at 14:17
  • thanks both of you for your help! I have checked and learned whats going on. I will try to use 'Not-in' method, but will have to change a db a bit. Thanks again! – Jan Smitka Jun 21 '21 at 15:03

0 Answers0