获取 Firestore 中的所有集合 [英] Fetching all collections in Firestore

查看:25
本文介绍了获取 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 管理员客户端在 listCollections() 上有 Firestore 获取该列表.或者,如果您要查找嵌套在文档下的子集合,请使用 DocumentReference.listCollections().

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆