I've been using Firestore to build an Android app and I run into the next limitation that I have no idea to deal with it.
I need to retrieve documents by tags that are stored in an array-field. However, there can be only one whereArrayContains
per query. How am I supposed to get documents by more than one tag?
Can you think of any clever solution to that?
You can only have one whereArrayContainsAny
condition on a query, but you can have up to 10 whereArrayContains
conditions.
From the documentation on query limitations:
- Cloud Firestore provides limited support for logical
OR
queries. Thein
andarray-contains-any
operators support a logicalOR
of up to 10 equality (==
) orarray-contains
conditions on a single field. For other cases, create a separate query for eachOR
condition and merge the query results in your app.
- You can use only one
in
orarray-contains-any
clause per query. You can't use bothin
andarray-contains-any
in the same query.