If I query like below it returns the document as expected. I also know that firestore query return results only when full object matches.
return firestore()
.collection(`stores`)
.where('servicesList', 'array-contains-any', [
{
price: 24,
serviceName: 'service1',
},
])
.onSnapshot((querySnapshot) => {
...
});
});
I have stores collection with these arrays where I need to make different queries for filters.
e.g. return all stores where Service Name = "Service1" and Price < 20
or return all stores where price > 20 etc..
my document structure is like this : document structure
What should be an efficient way to achieve this ?
One solution is to get all stores on first load and filter on client side. I wonder if this can be done using the query.
Thanks