Filtering a Firestore call with OR condition
Hi, I'm trying to retrieve all documents with one or both of two booleans set to "true".
I've tried all sorts of variants on the below but no joy:
{
"condition": "OR",
"rules": [
{
"field": "behaviourist",
"operator": "==",
"value": true
},
{
"field": "trainer",
"operator": "==",
"value": true
}
]
}
Thanks in advance!
Solution:Jump to solution
Hi @JamesG, Add the Filters in array: [{field:"user1",value:"test",operator:"=="},
{field:"user",value:"true",operator:"=="}] to set multiple filter in Firestore collection query....
3 Replies
Solution
Hi @JamesG, Add the Filters in array: [{field:"user1",value:"test",operator:"=="},
{field:"user",value:"true",operator:"=="}] to set multiple filter in Firestore collection query.
Thanks @Gaurav Chadha, but that applies multiple filters together so is an AND condition. I need OR, if that's possible.
For OR, you can modify the filter logic to have:
Supported filter query operators - https://cloud.google.com/firestore/docs/query-data/queries#query_operators.