When i add orderBy app is not working in firestore

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-05 09:27:22

问题


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>

but when i remove orderby app work fine

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

回答1:


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.



来源:https://stackoverflow.com/questions/56714911/when-i-add-orderby-app-is-not-working-in-firestore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!