Yes, multiple "array-contains" queries can be implemented in Firestore through a workaround. One approach is to denormalize the data by creating a separate collection for each value that needs to be searched. For example, if you have a collection of books and want to search for books that contain both "mystery" and "fiction" genres, you can create two additional collections: one for books that belong to the "mystery" genre and another for books that belong to the "fiction" genre. Then, you can perform "get" queries on both collections and intersect the results to find books that exist in both collections.
Another approach is to store the data in an alternative data store, such as Elasticsearch, which has better support for complex search queries. You can use Firestore triggers to keep the data in sync between Firestore and Elasticsearch.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-23 03:32:09 +0000
Seen: 9 times
Last updated: May 23 '23