以编程方式查找Firestore Doc的所有子集合

编程入门 行业动态 更新时间:2024-10-10 00:28:57
本文介绍了以编程方式查找Firestore Doc的所有子集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有什么方法可以以编程方式访问文档中的子集合而无需明确知道其名称?我本质上是在寻找类似于firestore().getCollections()的函数,但要的是文档而不是数据库的根.

Is there any way to programmatically access the subcollections in a document without explicitly knowing their name? I'm essentially looking for a function similar to firestore().getCollections() but for a document rather than the root of the database.

db .collection("collection") .doc("document") .get() .then(doc => { if (doc.exists) { doc.getCollections().then(collections => { //do stuff }); } }) //...

很显然docSnapshots没有此功能,但是还有其他方法可以实现此功能吗?还是您必须提前知道子集合的名称?

Obviously docSnapshots don't have this function, but is there any other way to achieve this? Or do you have to know the subcollection's name ahead of time?

推荐答案

我是个白痴.

db .collection("collection") .doc("document") .getCollections() .then(collections => { //do stuff });

更多推荐

以编程方式查找Firestore Doc的所有子集合

本文发布于:2023-11-29 15:52:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1646857.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:方式   Firestore   Doc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!