【发布时间】:2022-01-21 18:27:39
【问题描述】:
我想得到下面屏幕截图中红色标记的值。
我也用谷歌尝试了很多东西,但我没有得到一个好的结果。
到目前为止我的代码:
firestore.collection('chats').doc(this.uid).get().subscribe(data => {
alert(data.data());
});
【问题讨论】:
-
你用红色圈起来的东西是什么?收藏?一份文件?或者是其他东西?请注意,集合通常应该具有已知名称,因为您无法获取文档的“所有子集合”,因此您需要已经知道集合的名称。一旦你这样做,访问它是
firestore.collection('chats').doc(this.uid).collection("the subcollection name").get() -
嗯,如果我不知道名字怎么办?是一个生成的字符串。我怎样才能改变我的结构来解决这个问题? ://
-
也许我们可以通过这种方式解决这个问题:我请求文档:firestore.collection('chats').doc(this.uid).what here to get it?然后我应该获得可以为 this.uid 制作 IF 的文档,并且在匹配时还应该交付集合还是我理解不对?
标签: javascript firebase ionic-framework google-cloud-firestore