简体   繁体   English

关于 Firestore 中的事务,如果我多次写入同一个文档,这些操作会被扁平化为一次写入吗?

[英]Regarding transactions in Firestore, if I write to the same document multiple times, will those operations get flattened to a single write?

If I update fieldA of my document and then later in the same transaction update fieldB , how many writes will this get counted as when I commit the transaction?如果我更新我的文档的fieldA ,然后在同一个事务中更新fieldB ,那么当我提交事务时,这将被计算为多少次写入?

If I update fieldA of my document and then later in the same transaction update fieldB, how many writes will this get counted as when I commit the transaction?如果我更新我的文档的字段 A,然后在同一个事务更新字段 B 中更新,那么当我提交事务时,这将计算多少次写入?

If you do the update operations, one after another, meaning that you call update() function two times, then you'll have to pay two write operations.如果你一个接一个地进行更新操作,这意味着你调用 update() function 两次,那么你将不得不支付两次写入操作。 However, as @Dharmaraj mentioned in his comment, you can update as many fields as you want, in a single update , and pay a single read.但是,正如@Dharmaraj 在他的评论中提到的那样,您可以在一次更新中更新任意数量的字段,并支付一次阅读费用。

However, if the second update is based on the processing of the first update, then yes, you'll have to pay two writes.但是,如果第二次更新基于第一次更新的处理,那么是的,您必须支付两次写入费用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 flutter firestore 中同一文档的多个事务失败 - Multiple transactions to same document failure in flutter firestore 在 Firebase 模拟器中一次更新后多次读取 Firestore 文档 - Firestore document is read multiple times after a single update in Firebase emulator 多个 collections 在 1 个批量写入 firestore - Multiple collections in 1 batched write firestore Firestore 写入文档 numpy 的无效类型错误 - Firestore write to document invalid type errors for numpy 如何优化 Cloud Firestore 中的读写操作? - How to optimize read-write operations in cloud Firestore? 如何在 firestore 中获取单个文档并将其显示在网站上 - How to get a single document in firestore and display it on a site Android Studio - 中止 Firebase Firestore 文档在时间限制后写入 - Android Studio - Abort Firebase Firestore document write after time limit 如何在 firestore 中编写以下规则? - How do I write the follow rule in firestore? 由于每个文档每秒写入 1 次限制而导致写入失败时,Firestore 是否会出错或重试? - Does Firestore through error or retries when write failed due to the 1 write per sec per document limitation? 如何获取 Firestore 中的所有用户,除了用户文档中的块数组列表中的用户? - How to get all users in Firestore except those in block array list inside user document?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM