Let's say I have a collection named pet with the following structure for a given document
document_ID = {
cat: either the cat's name in string or null
dog: either the dog's name in string or null
}
I'd like to query all the documents based on the following condition: either 'cat' or 'dog' field has non-null value. That is, exclude only the documents where both 'cat' and 'dog' fields are null.
If it were 'and' condition, I'd run the query like below, but how do I do the query based on 'or' condition? Is this even possible? If not, what might be a possible workaround?
firestore.collection('pet').where('cat','!=',null).where('dog','!=',null).get()
.then(querysnapshot=>{
//Do some operations with the result
})