【问题标题】:Issue in the firestore while running through cloud function通过云功能运行时在 Firestore 中出现问题
【发布时间】:2020-12-09 15:50:35
【问题描述】:

我已经按照https://github.com/GoogleCloudPlatform/solutions-gcs-bq-streaming-functions-python/blob/master/functions/streaming/main.py实现了我的python代码

我没有使用存储触发器,而是通过云调度程序使用 pubsub 触发器并加载存储桶中存在的文件。

但是在运行该函数时,我遇到了错误。

raise valueerror("一个文档必须有偶数个路径元素")

我在需求文件中使用 Firestore 版本 1.8.1。

有人可以建议我这里有什么问题吗?

【问题讨论】:

    标签: python google-cloud-platform google-cloud-firestore google-cloud-functions google-cloud-pubsub


    【解决方案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')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-10
      • 2020-10-26
      • 2019-10-06
      • 2021-04-30
      • 1970-01-01
      • 2021-02-24
      • 2021-02-06
      • 1970-01-01
      相关资源
      最近更新 更多