我想自動化一個firestore數據庫的備份過程。這個想法是循環遍歷根文檔來構建一個JSON樹。 但我沒有找到一種方法來獲取文檔的所有集合。我想這是可能的,因爲在Firestore控制檯中我們可以看到樹。 任何想法?Firestore - 獲取文檔集
2
A
回答
3
如果使用Node.js的服務器SDK可以在DocumentReference
使用getCollections()
方法:
此方法將返回一個承諾對於數組CollectionReference
對象,您可以使用它來訪問集合中的文檔。
0
getCollections()方法可用於NodeJS。
示例代碼:
db.collection("Collection").doc("Document").getCollections().then((querySnapshot) => {
querySnapshot.forEach((collection) => {
console.log("collection: " + collection.id);
});
});
相關問題
- 1. 無法獲取文檔的FireStore
- 2. FIRESTORE - 如何獲取文檔中集合的值?
- 3. Firestore - 如何從DocumentSnapshot獲取集合?
- 4. 如何獲取文檔路徑以刪除/編輯Firestore中的文檔?
- 5. 使用Firestore在Cloud功能中獲取/添加文檔
- 6. Cloud Firestore - 從多個位置獲取文檔
- 7. 獲取位於Google Firestore中文檔內的收藏ID
- 8. Firestore文檔get()性能
- 9. 從firestore集合中引用的文檔訪問數據
- 10. Firestore規則,什麼是集合和文檔?
- 11. 公司的FireStore:從收集查詢所有文檔
- 12. Flutter Firestore - 查找`文檔快照「ID
- 13. firebase/firestore文檔查詢不工作 - javascript
- 14. Firebase - Firestore - 我會讀多少次文檔
- 15. 公司的FireStore安全規則:文檔
- 16. Firestore:加入vs Firestore定價
- 17. Cloud Firestore深獲得子集合
- 18. angular + firestore:如何允許公衆讀取文檔
- 19. 使用AngularFire2我嘗試從單個Firestore文檔獲取數據。(1)關於文檔值更改
- 20. 獲取文檔SQL
- 21. 獲取文檔ID
- 22. Firestore安全規則
- 23. Firebase - Firestore - 使用collection.add獲取密鑰
- 24. Cooliris從google獲取文檔:
- 25. 在xquery中獲取文檔
- 26. 獲取PDF文檔大綱
- 27. 獲取文檔的URL
- 28. 獲取XML文檔發送
- 29. vb.net - webbrowser獲取xml文檔
- 30. 用BeautifulSoup獲取文檔DOCTYPE
我無法找到任何東西在網絡側類似(JavaScript的瀏覽器)。只是我,還是? – Leo
這是正確的,目前僅在服務器端SDK中實現。 –
我只注意到可以在服務器端運行代碼。這將在Node.js上運行。現在是否有可能使用它來調用getCollections()並將結果輸出到客戶端? – Leo