Angularfire2我正在尝试获取有角火文件的字段名称

时间:2019-01-10 18:22:33

标签: angular firebase angularfire2 angular7

我有一个名为“ post”的firebase集合,其中有一个名为“ test1”的文档,我试图读取“ test1”文档的字段名称,并将其放置在数组中。但是自从我刚开始学习firebase以来,我不知道该怎么做,这与我的SQL经验大不相同。

这是我的构造函数

constructor(private afs: AngularFirestore, private dialog: MatDialog) {
this.itemsCollection = afs.collection<Item>('posts');
this.items = this.itemsCollection.snapshotChanges().pipe(
  map(actions => actions.map(a => {
    const data = a.payload.doc.data() as Item;
    const id = a.payload.doc.id;
    return {id, ...data};
  })));
}

image of my firebase collection

感谢您的帮助。

0 个答案:

没有答案