Tow*_*boy 0 python google-cloud-firestore
嗨,我一直在兜圈子,试图将我的Firestore数据放入Python 2字典中。
doc_ref = db.collection('things1').document('ref1').collection('things2').document('ref2')
doc = doc_ref.get()
Run Code Online (Sandbox Code Playgroud)
给我一个DocumentSnapshot-我希望得到一个字典。从结果中创建字典的正确方法是什么?尝试了文档,最后得到了对象。我在做些愚蠢的事情。
谢谢
您可以使用to_dict()。这应该给您结果字典。
doc_ref = db.collection('things1').document('ref1').collection('things2').document('ref2')
doc = doc_ref.get().to_dict()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1927 次 |
| 最近记录: |