【发布时间】:2020-09-27 06:53:55
【问题描述】:
目前我正在做一个 Angular 项目,我需要从 firebase 中过滤记录。我用 where 子句查询 firebase。但它正在从集合中返回所有文档,因此无法正常工作。
这是我的查询
this.firestore.collection('cities', ref => {
// ref.where("country", '==', "India");
ref.where("state", "==", "Tripura");
return ref;
})
.get().toPromise().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
console.log(doc.id, "=>", doc.data());
});
});
其中 this.firestore 是 AngularFirestore 类型。
【问题讨论】:
标签: angular firebase angularfire