'How the "And" filter query works in Firebase/Flutter when multiple where filters are connected or is there any other solution?
I have this following Firebase query in Flutter where I would like to get no result when both or either of the user doesn't exist in document:
_firestore
.collection('chat')
.where("users.user1", isNotEqualTo: null)
.where("users.user3", isNotEqualTo: null)
.get()
But I still get 1 result when user1 exist but not user3. It seems like connecting where clause in firebase works as OR but not AND. How do I resolve this issue?
Solution 1:[1]
Here's the solution:
_firestore
.collection('chat')
.where("users.user1", isEqualTo: true)
.where("users.user3", isEqualTo: true)
.get()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shaz |
