Closed anjali198 closed 4 years ago
Firestorter can only do what Firestore can do. My understanding is you're looking to provide multiple IDs to search for returning all that match. This would need an OR condition which Firestore does not support.
However, you could easily mimic this behavior by using a Mobx computed property that combined multiple queries or Document instances.
Hi, @damonmaria has already provided the correct answer. Google Firestore in its-self cannot query on multiple Ids. If you want to do that then you will need to define multiple queries in the client-side and aggregate the results yourself.
function getMany(collectionRef, ...ids) {
return Promise.all(ids.map(id => collectionRef.doc(id).get());
}
getMany("id1", "id2") // or getMany(...["id1", "id2"])
.then(([result1, result2]) => {
// result1.data().foo
// result2.data().foo
}
I want to query with multiple Ids or multiple where conditions from a collection in a single query, please help me with it if anyone has worked on it? While querying more than once for the same condition every time getting the different collection in the result and also not able to merge those collections to show it on the same page.