【发布时间】:2023-01-22 21:36:37
【问题描述】:
我想使用 Flutter 对 Firestore 中的多个字段进行查询。我使用FirebaseFirestore.instance.collection('sgees').orderBy('uid').orderBy('timestamp').get()。但我收到以下错误:
Listen for Query(target=Query(sgees order by uid, timestamp, __name__);limitType=LIMIT_TO_FIRST) failed: Status{code=FAILED_PRECONDITION, description=The query requires an index. You can create it here: https://console.firebase.google.com/v1/r/project/myfirebaseprojectname/firestore/indexes?create_composite=Ck9wcm9qZWN0cy9mbHV0dGVyLXNhbGFtLWFwcC9kYXRhYmFzZXMvKGRlZmF1bHQpL2NvbGxlY3Rpb25Hcm91cHMvc2dlZXMvaW5kZXhlcy9fEAEaBwoDdWlkEAEaDQoJdGltZXN0YW1wEAEaDAoIX19uYW1lX18QAQ
Unhandled Exception: [cloud_firestore/failed-precondition] The query requires an index. You can create it here: https://console.firebase.google.com/v1/r/project/myfirebaseprojectname/firestore/indexes?create_composite=Ck9wcm9qZWN0cy9mbHV0dGVyLXNhbGFtLWFwcC9kYXRhYmFzZXMvKGRlZmF1bHQpL2NvbGxlY3Rpb25Hcm91cHMvc2dlZXMvaW5kZXhlcy9fEAEaBwoDdWlkEAEaDQoJdGltZXN0YW1wEAEaDAoIX19uYW1lX18QAQ
解决办法是什么?提前致谢。
【问题讨论】:
标签: flutter google-cloud-firestore