当我添加orderBy应用程序无法在Firestore中运行时

时间:2019-06-22 11:01:57

标签: angular typescript firebase google-cloud-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)



我的密码

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

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

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

1 个答案:

答案 0 :(得分:1)

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