是否可以使用 python 列出文檔的子集合?谷歌文檔似乎不一致他們在這里說 get collections 方法在 Python 客戶端庫中不可用:https://firebase.google.com/docs/firestore/query-data/get-data#python_6他們在這里說 class collections() 列出子集合:https://googleapis.dev/python/firestore/latest/document.html所以我嘗試類似的東西:collnameref = db.collection(collname)docs = collnameref.stream()for doc in docs: print (doc.collections())但它不起作用。
1 回答
智慧大石
TA貢獻1946條經驗 獲得超3個贊
你是對的。文檔中缺少此內容:
collnameref = db.collection(collname)
docs = collnameref.stream()
for doc in docs:
# List subcollections in each doc
for collection_ref in doc.reference.collections():
print(collection_ref.parent.path + collection_ref.id)
添加回答
舉報
0/150
提交
取消
