【发布时间】:2018-04-30 19:46:34
【问题描述】:
如何从根级别获取所有集合?
据我所知,Cloud Firestore 控制台允许在根级别添加多个集合。
我找到了some solution to get documents of particular collection,但我没有了解关于收藏的相同内容。
有没有办法获取根级别的所有集合名称?
【问题讨论】:
标签: javascript firebase google-cloud-firestore
如何从根级别获取所有集合?
据我所知,Cloud Firestore 控制台允许在根级别添加多个集合。
我找到了some solution to get documents of particular collection,但我没有了解关于收藏的相同内容。
有没有办法获取根级别的所有集合名称?
【问题讨论】:
标签: javascript firebase google-cloud-firestore
Firebase SDK 中没有用于迭代集合的 API。同样,没有用于迭代文档子集合的 API。您必须提前知道集合的名称才能在客户端上使用它。
如果您使用的是包含 Google Cloud Firestore SDK 的 Admin SDK for Node,那么有一个 API Firestore.getCollections() 可以满足您的需求。
【讨论】: