M.A*_*Ali -1 firebase google-cloud-firestore
UserCollection/{id}/PlayerCollection/{id}
Run Code Online (Sandbox Code Playgroud)
在最后一个文档中,有多个字段
active: true or false
dateInMillies : 123456789
return _firestore
.collection('UserCollection')
.document(userID)
.collection("PlayerCollection")
.orderBy('dateInMillis', descending: true)
.where('active', isEqualTo: true)
.snapshots();
Run Code Online (Sandbox Code Playgroud)
此代码块通过异常:
failed: Status{code=FAILED_PRECONDITION, description=The query requires an index. You can create it here: link to fix it
Run Code Online (Sandbox Code Playgroud)
但是链接已损坏,所以我必须手动完成!
所以,我去了索引选项卡,并创建了一个新的复合索引
collectionID : PlayerCollection
Fields Indexed: dateInMillis : Descending , active : Ascending
Run Code Online (Sandbox Code Playgroud)
但也没有用!
我有一个替代答案。
确保打开链接时最后没有包含任何随机字符。我从 vscode 的终端打开链接,它实际上有三个可以打开的链接,但其中两个有一个尾随逗号,它在 Firebase 控制台中打开了一个白屏。
归档时间: |
|
查看次数: |
1243 次 |
最近记录: |