【发布时间】:2018-04-18 22:30:07
【问题描述】:
我在使用 Angular 2 从 Firestore 查询数据时遇到了一些问题。
谁能帮我检查一下并告诉我哪里做错了?
我的错误:
ERROR Error: The query requires an index. You can create it here: https://console.firebase.google.com/project/admin-e8a7b/database/firestore/indexes?create_index=EgR0ZW1wGgcKA3VpZBACGg0KCXN0YXJ0ZWRBdBADGgwKCF9fbmFtZV9fEAM
at new FirestoreError (vendor.bundle.js:19925)
这是我的代码:
getTemp(uid): Observable<any> {
let temps = [];
var today = new Date();
return this.afs.collection<Temps>('temp', ref => ref.where('uid', '==', uid).orderBy('startedAt', 'desc')).snapshotChanges()
.map(actions => {
return actions.map(action => {
const data = action.payload.doc.data() as Temps;
console.log(data.temp);
return data.temp;
});
});
}
【问题讨论】:
-
我需要你的帮助!
标签: angular firebase google-cloud-firestore