Imagine I have a collection in Firestore with objects of the following format:
{
/* ... */
ownerId: "id-1",
memberIds: [
"id-2",
"id-3",
"id-4"
]
}
How can I query Firestore for all documents where the string id-1 is present in the ownerId field OR the memberIds field?
I only found AND queries, like so:
return collection('whatever')
.where('memberIds', 'array-contains', 'id-1')
.where('ownerId', '==', 'id-1');
But those will only return me the documents where id-1 is included in both the ownerId field and the memberIds array.
I understand that I could perform multiple queries and join the results, but that would make pagination and ordering too much of a hassle to implement.