当我添加 orderBy 应用程序在 firestore 中不起作用时

2024-04-28

onSnapshot 中未捕获的错误:错误:查询需要索引。你 可以在 new FirestoreError (index.cjs.js:352) 处创建它 在 JsonProtoSerializer.push../node_modules/@firebase/firestore/dist/index.cjs.js.JsonProtoSerializer.fromRpcStatus (索引.cjs.js:5862) 在 JsonProtoSerializer.push../node_modules/@firebase/firestore/dist/index.cjs.js.JsonProtoSerializer.fromWatchChange (index.cjs.js:6359) 在 PersistentListenStream.push../node_modules/@firebase/firestore/dist/index.cjs.js.PersistentListenStream.onMessage (index.cjs.js:14974) 在index.cjs.js:14903 在index.cjs.js:14943 在index.cjs.js:7656 在 ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (区域.js:388) 在 Object.onInvoke (core.js:13851) 在 ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (区域.js:387)



我的代码

this.firestore.collection('mycollection').ref
        .orderBy("created","desc")
        .where("field","==",true) 
    <br>

但是当我删除 orderby 应用程序时工作正常

this.firestore.collection('mycollection').ref 
        .where("field","==",true) 

该错误应包含一个链接,您可以单击该链接来创建所述索引。您只需点击它并等待即可。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

当我添加 orderBy 应用程序在 firestore 中不起作用时 的相关文章

随机推荐