[在检索集合的所有文档时在angularfire中获取另一个文档的文档参考字段的数据

问题描述 投票:0回答:1

Here is the document storing model. Screen shot of firestore

我想显示使用machineRef和siteRef检索所有机器站点地图

getActiveMachineSiteMap() {
    return this.db.collection('machine-site-map',
      ref => ref.where('IsActive', '==', true))
      .valueChanges({ idField: 'Id' });
}

因此,我没有机器和站点

google-cloud-firestore angular8 angularfire
1个回答
0
投票

根据有关Querying and filtering data的文档示例,方法db.collection仅使用一个参数。所以在这种情况下,您的功能应该像这是文档存储模型。消防站的屏幕截图我想显示使用machineRef和siteRef检索所有机器站点地图

getActiveMachineSiteMap() {
    return this.db.collection('machine-site-map').where('IsActive', '==', true)
      .valueChanges({ idField: 'Id' });
}

还有一些关于Collections in AngularFirestore的文档,您可以在github中查看,它可能有助于您解决一些疑问。

© www.soinside.com 2019 - 2024. All rights reserved.