Firestore-获取文档集合 [英] Firestore - Get document collections
问题描述
如果使用的是Node.js服务器SDK,则可以在DocumentReference
上使用getCollections()
方法:
https://cloud.google.com/nodejs/docs /reference/firestore/0.8.x/DocumentReference#getCollections
此方法将返回一个CollectionReference
对象数组的承诺,可用于访问集合中的文档.
i would to automate backup process of a firestore database. The idea is to loop over root document to build a JSON tree. but i didn't find a way to get all collections available for a document. I guess it's possible as in firestore console we can see the tree. Any ideas ?
If you are using the Node.js server SDK you can use the getCollections()
method on DocumentReference
:
https://cloud.google.com/nodejs/docs/reference/firestore/0.8.x/DocumentReference#getCollections
This method will return a promise for an array of CollectionReference
objects which you can use to access the documents within the collections.
这篇关于Firestore-获取文档集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!