【问题标题】:Are Firestore updates charged the same cost as writes?Firestore 更新的费用是否与写入费用相同?
【发布时间】:2018-11-21 07:18:43
【问题描述】:

根据Firestore documentation,可以更新单个字段而不更新整个文档:

def update_create_if_missing():
db = firestore.Client()
city_ref = db.collection(u'cities').document(u'BJ')

city_ref.update({
    u'capital': True
}, firestore.CreateIfMissingOption(True))

Firestore 更新是否按写入收费?

是否有诸如“如果不同则更新”之类的选项,而不是当前缺少的选项?

我已经构建了一个相当繁重的价格比较应用程序,每天更新超过 100 万种产品(每个产品都是 Firestore 中的一个文档)。如果我必须在 Firestore 读取之上每天支付 1.000.000 次写入,那将是相当昂贵的。

我可以探索其他选择吗?

【问题讨论】:

    标签: google-cloud-datastore google-cloud-firestore


    【解决方案1】:

    Firestore 文档更新与写入没有什么不同。任何更改文档的操作都被视为写入。

    【讨论】:

    • 覆盖文档上的相同数据是否算作另一次写入?由于 Firestore 不必更新其索引。
    • @SlickSlime 如果您的问题在现有的定价文档中没有得到解决,您应该联系 Firebase 支持以解决有关计费的问题。 firebase.google.com/support/contact
    【解决方案2】:

    为了补充 Doug 的答案,Firestore 将文档创建、更新甚至删除视为可计费的写入事件。阅读更多关于他们的官方文档here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-21
      • 1970-01-01
      • 2020-07-18
      • 1970-01-01
      • 1970-01-01
      • 2020-12-04
      • 1970-01-01
      相关资源
      最近更新 更多