Richard
Richard

Reputation: 948

Querying with != and not-in throws error with Query.where in firestore

I tried using != and not-in as params to Query.where as described here:

    db.collection("users")
      .where(firebase.firestore.FieldPath.documentId(), "!=", curUser.uid)
      .get()
      .then((snapshot) => {
         ...
      });

But I'm getting the following error:

Invalid value "!=" provided to function Query.where() for its second argument. Acceptable values: <, <=, ==, >=, >, array-contains, in, array-contains-any

I even tried this on an ordinary non-document id field and it gives the same error.

I am using the node package firebase version 7.9.0.

Upvotes: 3

Views: 809

Answers (1)

Peter Haddad
Peter Haddad

Reputation: 80924

You need to use the latest version to be able to use not equal queries:

npm install [email protected] --save

!= was released in version 7.21.0:

https://firebase.google.com/support/release-notes/js#version_7210_-_september_17_2020

Upvotes: 5

Related Questions