正在尝试获取 child 文档的 parent 集合

Trying to fetch child collection of parent document

我在 Ionic 3 应用程序中使用 AngularFire2 从 Angular Firestore 数据库中获取数据。在数据库中,我有一个 '/Products/' 集合,其中的每个文档都有一个 '/Versions/' child 集合:

在我的应用程序中,我已经获取了产品(转换为 DTO)并且想要获取它的 child 版本。我一直在尝试不同的方法,但似乎无法弄清楚如何引用 child.

这是我用来获取产品的代码:

this.fireStore.collection('/Products/', i => i.orderBy('Title'));

一旦我有了 Product object,我该如何获取它的版本?

编辑:有人问我到目前为止有什么代码,但如您所见,我缺少 'product' 和相关版本之间的 link:

public getVersionsForProduct(product: Product) : AngularFirestoreCollection<Version>{
    var vers = this.fireStore.collection<Version>('/Version/');
    return vers;
  }

在没有看到所有相关代码的情况下很难说,但您可以获得这样的子集合:

public getVersionsForProduct(product: Product) : AngularFirestoreCollection<Version> {

    const vers = this.fireStore.collection('Products').doc(product.id).collection<Version>('Versions'); 
    return vers;
  }