【发布时间】:2018-01-03 20:42:07
【问题描述】:
我有一个 Firestore,其中包含一个包含子集合(称为“事物”)的集合(项目)。当我得到我的 Items 集合时,我得到了所有子文档,但没有得到任何子集合。我想做一个深度检索,一个名为 Items 的对象,其中包含子集合。
我知道这不可能开箱即用,但我正在努力自己编写代码来做到这一点。
谁能帮忙?
constructor(public afs: AngularFirestore) {
//this.items = this.afs.collection('Items').valueChanges();
this.itemsCollection = this.afs.collection('Items', ref => ref.orderBy('year', 'asc'));
this.items = this.itemsCollection.snapshotChanges().map(changes => {
return changes.map(a => {
const data = a.payload.doc.data() as Item;
data.id = a.payload.doc.id;
return data;
});
});
}
getItems() {
return this.items;
}
【问题讨论】:
标签: javascript angular google-cloud-firestore