I've seen this question before for an earlier version of Firebase that is no longer applicable for Firebase Cloud Firestore.
I would like to make a query that checks a document's field's value against a list of potential values, something like whereEqualTo(someField, a OR b OR c OR ... OR n)
. Specifically, I have a list of potential values for a single field of type Reference and I want my query to return all documents in the specified collection whose value of the field is equal to one of the potential values in the list. I am also using .limit(10)
because I am paginating data.
So for example, if my list contained the References [ref1, ref2, ref3] then the query would be similar to joining these 3 queries:
Query query1 = mDatabase.collection("myCollection").whereEqualTo("refField", ref1);
Query query2 = mDatabase.collection("myCollection").whereEqualTo("refField", ref2);
Query query3 = mDatabase.collection("myCollection").whereEqualTo("refField", ref3);
On the documentation, under the "Limitations" section, it mentions:
Logical OR queries. In this case, you should create a separate query for each OR condition and merge the query results in your app.
So maybe the best way would be to merge query results, but how could this be done, and with limiting to 10 results?
Note that I am working with Java for Android Development.