当我添加orderBy应用程序无法在Firestore中工作时 [英] When i add orderBy app is not working in firestore

查看:29
本文介绍了当我添加orderBy应用程序无法在Firestore中工作时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

onSnapshot中未捕获的错误:错误:查询需要索引.你可以在此处通过新的FirestoreError(index.cjs.js:352)创建它在JsonProtoSerializer.push ../node_modules/@firebase/firestore/dist/index.cjs.js.JsonProtoSerializer.fromRpcStatus(index.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(zone.js:388)在Object.onInvoke(core.js:13851)在ZoneDelegate.push ../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke(zone.js:387)

Uncaught Error in onSnapshot: Error: The query requires an index. You can create it here at new FirestoreError (index.cjs.js:352) at JsonProtoSerializer.push../node_modules/@firebase/firestore/dist/index.cjs.js.JsonProtoSerializer.fromRpcStatus (index.cjs.js:5862) at JsonProtoSerializer.push../node_modules/@firebase/firestore/dist/index.cjs.js.JsonProtoSerializer.fromWatchChange (index.cjs.js:6359) at PersistentListenStream.push../node_modules/@firebase/firestore/dist/index.cjs.js.PersistentListenStream.onMessage (index.cjs.js:14974) at index.cjs.js:14903 at index.cjs.js:14943 at index.cjs.js:7656 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:388) at Object.onInvoke (core.js:13851) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:387)



我的密码



My code

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

但是当我删除orderby应用时,效果很好

but when i remove orderby app work fine

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

推荐答案

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

The error shall contain a link on which you can click to create the said index. You just have to click on it and wait.

这篇关于当我添加orderBy应用程序无法在Firestore中工作时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆