Firestore index on maps and array - clarification
我试图了解Firestore如何在字段上创建索引。 给定以下样本文档,如何创建索引,尤其是对于地图/数组?
我多次阅读了Cloud Firestore中"索引类型"上的文档,但仍不 那里说:
Automatic indexing
By default, Cloud Firestore automatically maintains single-field indexes for each field in a document and each subfield in a map. Cloud Firestore uses the following default settings for single-field indexes:
For each non-array and non-map field, Cloud Firestore defines two collection-scope single-field indexes, one in ascending mode and one in descending mode.
For each map field, Cloud Firestore creates one collection-scope ascending index and one descending index for each non-array and non-map subfield in the map.
For each array field in a document, Cloud Firestore creates and maintains a collection-scope array-contains index.
Single-field indexes with collection group scope are not maintained by default.
如果我正确理解这一点,那么将为每个字段创建索引,即使对于
因此,如果我要搜索
我的假设/理解正确吗?
不,您的理解不正确。
Firestore完全不允许未索引的查询。 失败的错误消息将包含指向控制台的链接,如果可能的话,该链接将使您可以创建该查询所需的索引。
如果您希望能够查询