0

I want to retrieve a value from firestore for in-equality, I know firestore does not support != operator. We have use this clause where("age", "<", "30").where("age", ">" 30) I want to know how i can use this clause if i want to retrieve the value of string

document.where('courseName','<','MBA').where('courseName','>','MBA').get().then(function(querySnapshot){
        querySnapshot.forEach(function(doc){
             var result3 ="Others"
            var result = querySnapshot.size
})
})

It is showing the value as null

mayank3503
  • 315
  • 4
  • 17
  • Your current query returns documents for which `courseName` is both smaller than `"MBA"` and bigger than `"MBA"`, which is by definition not true for any documents. Firestore doesn't support inequality queries. See the question I linked for more answers. – Frank van Puffelen Nov 23 '19 at 15:19
  • So how i can get a document where ```courseName``` is not ```MBA```. Is there any way? – mayank3503 Nov 23 '19 at 15:33
  • You'll need to fire two queries and then combine them client-side. – Frank van Puffelen Nov 23 '19 at 16:10

0 Answers0