0

I have list of strings, and using not operator I wanted to select all values except one. But I couldn't find anything about not opertor in the firebase website. Please help me with this issue.

P.S: This Link explains how to do the inequality operation with numbers, and not strings

Sethuraman Srinivasan
  • 1,528
  • 1
  • 20
  • 34

2 Answers2

0

It's a limitation with Cloud Firestore queries. But I found a workaround. Cloud Firestore Documentation states,

"Queries with a != clause. In this case, you should split the query into a greater-than query and a less-than query. For example, although the query clause where("age", "!=", "30") is not supported, you can get the same result set by combining two queries, one with the clause where("age", "<", "30") and one with the clause where("age", ">", 30)."

Sethuraman Srinivasan
  • 1,528
  • 1
  • 20
  • 34
0

New update on Firestore now supports not equal and not in queries. As mentioned here:

const capitalNotFalseRes = await citiesRef.where('capital', '!=', false).get();
const notUsaOrJapan = await citiesRef.where('country', 'not-in', ['USA', 'Japan']).get();
jeadonara
  • 1,176
  • 10
  • 10