Home > Blockchain >  When does Firestore automatically retry plain document writes?
When does Firestore automatically retry plain document writes?

Time:11-26

  1. If I perform an update operation on a document in Firestore, and I know for certain that the document exists, what possible reason, outside of my control, could an error be generated?
  2. And if an error is generated, is the update automatically retried?
  3. Or is this update only automatically retried if there is no connection and Firestore's offline capabilities take over?

CodePudding user response:

  1. If I perform an update-data operation on a document in Firestore, and I know for certain that the document exists, what possible reason, outside of my control, could an error be generated?

A common error that can arise, is when the Firebase servers reject an operation due to improper security rules. Meaning that you are not allowed to do that particular operation.

  1. And if an error is generated, is the update automatically retried?

No, that will not happen while online.

  1. Or is this update only automatically retried if there is no connection and Firestore's offline capabilities take over?

Yes, that will indeed happen. All operations that take place while offline, are added to a queue. Behind the scenes, Firestore SDK tries to reconnect until the devices regain connectivity. Once the user regains the connection, every change that is made while offline will be updated on Firebase servers. In other words, all update operations will be committed on the server, as long as you have proper rules.

  • Related