问题描述
实现了我的python代码
我不是通过存储触发器,而是通过云调度程序使用pubsub触发器并加载存储桶中的文件。
但是在运行该功能时,我遇到了以下错误。
引发valueerror(“文档必须具有偶数个路径元素”)
我正在需求文件中使用Firestore版本1.8.1。
有人可以建议我这里有什么问题吗?
解决方法
该错误表示您正在尝试将Firestore集合用作文档。检查所有Firestore文档路径是否正确。
# Odd number of path elements means it's a collection,not a doc
doc_ref_error = db.document('collection/document/subcollection')
# Fixed
doc_ref = db.document('collection/document/subcollection/subdocument')