是否可以使用 python 列出文档的子集合?
看来google文档不一致
这里他们说 get collections 方法在 Python 客户端库中不可用:
https://firebase.google.com/docs/firestore/query-data/get-data#python_6 https://firebase.google.com/docs/firestore/query-data/get-data#python_6
这里他们说类 collections() 列出子集合:
https://googleapis.dev/python/firestore/latest/document.html https://googleapis.dev/python/firestore/latest/document.html
所以我尝试这样的事情:
collnameref = db.collection(collname)
docs = collnameref.stream()
for doc in docs:
print (doc.collections())
但它不起作用。
你说得对。文档中缺少此内容:
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)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)