通过标签获取文档

Get documents by tags

我一直在使用 Firestore 构建一个 Android 应用程序,但我 运行 遇到了下一个我不知道要处理的限制。

我需要通过存储在数组字段中的标签来检索文档。但是,只能有一个whereArrayContains 每个查询。我应该如何通过多个标签获取文档?

你能想到什么聪明的解决办法吗?

一个查询只能有一个 whereArrayContainsAny 个条件,但最多可以有 10 个 whereArrayContains 个条件。

来自 query limitations 上的文档:

  • Cloud Firestore provides limited support for logical OR queries. The in and array-contains-any operators support a logical OR of up to 10 equality (==) or array-contains conditions on a single field. For other cases, create a separate query for each OR condition and merge the query results in your app.
  • You can use only one in or array-contains-any clause per query. You can't use both in and array-contains-any in the same query.