【发布时间】:2021-07-14 18:23:33
【问题描述】:
我正在尝试在 FirebaseFirestore.instance.collection('collectionName').where('fieldName1', isEqualTo: 'value1').orderBy('fieldName1', descending:true).snapshots() 语句中执行包含 where 和 orderBy 的查询。我还为上述语句中定义的两个字段创建了一个复合索引。
但是,我收到了这个错误:
[log] [cloud_firestore/failed-precondition] Operation was rejected because the system is not in a state required for the operation's execution. If performing a query, ensure it has been indexed via the Firebase console.
我正在使用
firebase_core: ^1.3.0
cloud_firestore: ^2.3.0
【问题讨论】:
-
可以分享创建的索引吗?您还在同一字段上使用 where 方法和 orderBy 吗?
标签: firebase flutter google-cloud-firestore