Firestore - 从集合中的文档获取集合条目

Firestore - get collection Entries from document in collection

我想获取下面截图中红色标记的值。

我也用 google 尝试了很多东西,但我没有得到好的结果。

到目前为止我的代码:

firestore.collection('chats').doc(this.uid).get().subscribe(data => {
      alert(data.data());
    });

如果您用红色圈出的是一个集合,您将必须知道集合名称,因为您无法[获取文档的“所有子集合”(https ://whosebug.com/questions/48258632/fetching-all-collections-in-firestore/48258777#48258777) 在客户端 SDKs.

因此您需要已经知道集合的名称。一旦你这样做,访问它是:

firestore
  .collection('chats')
  .doc(this.uid)
  .collection("the subcollection name")
  .get()