google-cloud-firestore - 未为集合组中的 arrayContains 生成 Firestore 索引 URL?
问题描述
snapshot1
使用和单个集合并snapshot2
使用集合组
final snapshot1 = await FirebaseFirestore.instance
.collection('users')
.doc('115309562732908784445')
.collection('user_activities')
.where('userGroupIDs', arrayContains: 'IIPwobuR3YLrOoLH3TeS')
.get();
final snapshot2 = await FirebaseFirestore.instance
.collectionGroup('user_activities')
.where('userGroupIDs', arrayContains: 'IIPwobuR3YLrOoLH3TeS')
.get();
snapshot1
snapshot2
通过throws生成罚款
Exception has occurred.
FirebaseException ([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.)
但我没有得到自动生成的 URL。上述消息与 VSCode 编辑器窗口重叠。我在调试控制台和 Firestore 日志中都没有看到任何 URL 消息。
我的查询有问题吗?或者有时您必须手动创建它们?
解决方案
我手动构建了索引,它运行良好。跟随Todd 的博客很简单。作为测试,我删除了几个现有的索引,调试器正确地给了我一个重建的 URL。不知道为什么它不喜欢这个。
推荐阅读
- php - phpspreadsheet没有检索某些单元格的值
- php - 2个不同表的乘法和结果为假
- javascript - 附加到我的电子邮件中的这个远程 javascript 做什么?“http://rum-static.pingdom.net/prum.min.js”
- recursion - Erlang、Last Call Optimization、lambda 函数以及如何防止堆栈增长
- node.js - 如何在 cPanel 上托管节点反应 Web 应用程序?
- python - 如何在python中使用其他文件的字符串打开文件?
- java - 保护 JMX 并防止远程客户端使用 javax.management.loading.MLet 注册任意 Mbeans JMX
- regex - 匹配包含混合文本和数字的 URL 产品着陆页,同时排除产品变体
- fabricjs - Fabric.js 版本 2.x getActiveGroup() 折旧和破坏应用程序
- php - 任务正在删除,但页面需要重新引用