获取Firestore中的所有集合 [英] Fetching all collections in Firestore
问题描述
我在项目中使用Firestore,所以我想显示项目中的所有集合名称.
I am using Firestore in my project, so i want to show all collection names in my project.
是否可以从Firebase项目中获取所有集合名称.
Is it posible to get all collection names from Firebase project.
谢谢..
推荐答案
只有有限的公共API可以获取顶级集合的列表.移动客户端(Android,iOS,Web)没有API. Node.js管理员客户端在
There are limited public APIs to get a list of top-level collections. Mobile clients (Android, iOS, web) have no API. Node.js admin clients have listCollections() on Firestore to get that list. Or, if you're looking for subcollections nested under a document, use DocumentReference.listCollections().
如果要在任何平台上获取列表,则应将该列表自己保存在已知文档ID中的已知集合中.
If you want to get a list on any platform, you should maintain that list yourself in a known collection inside a known document id.
这篇关于获取Firestore中的所有集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!