3

I'm using Angular Firestore in my app, and I'm having a problem to write a query that will return all of the objects I'm needed

In the following example, I get all the fruits that got that user id in their eat_by array

this.asf.collection('fruits', ref => ref.where('eat_by', 'array-contains', userId)).valueChanges();

and its working great

But the problem I'm having is doing the opposite thing; I'm trying to get the fruits that don't have that userId in there eat by the array. Like $nin in mongo.

I need that the field value is not in the specified array operator

did you handle with that thing before ?

how did you resolve it ?

there is any good workaround ?

Thank you

Matan Shushan
  • 1,204
  • 1
  • 10
  • 25

1 Answers1

0

firebaser here

There is no "array does not contain" operation is Cloud Firestore at the moment.

I highly recommend reading Doug's answer here, as it explains why this operation is not supported. Unfortunately the workaround proposed there, won't work for "array does not contain" operations.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807