【问题标题】:iOS - Firestore Document Multiple Writes at same timeiOS - Firestore 文档同时写入多个
【发布时间】:2021-04-30 17:06:21
【问题描述】:

我有两个用户写入同一个文档 - 当写入同时发生时,似乎存在数据完整性问题。使用 iOS Firestore 处理这种竞争条件的最佳方法是什么?

【问题讨论】:

  • 请添加您的代码并说明您是如何尝试同时写入数据的。

标签: ios firebase google-cloud-firestore


【解决方案1】:

您应该使用 Firestore 事务。只要在您编写时其他人修改了文档,事务就会失败。在此处阅读更多信息:

Firestore Transactions

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-11
    • 2022-01-25
    • 1970-01-01
    • 2022-01-03
    • 1970-01-01
    • 2018-06-18
    • 1970-01-01
    相关资源
    最近更新 更多