You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The node.js API for DocumentReference.update allows an optional second argument, Preconditions. This is missing from the firebase-admin-interop implementation.
The Dart package implements the Precondition object, documents it as used in Transaction, DocumentReference, and WriteBatch, but it is only available in the Transaction.update call, not the other two.
The firestore_binding js DocumentReference collection seems to declare the JS call with the correct arguments:
external Promise update(UpdateData data, [Precondition precondition]);
So it seems like the Dart DocumentReference implementation could just call
nativeInstance.update(docData, _getNativePrecondition(lastUpdateTime))
in the case that an optional Timestamp is passed to it, as is the case with Transaction.
I would like to update documents from DocumentReference, but be sure that I am not overwriting other's changes.
The text was updated successfully, but these errors were encountered:
It turns out that for my use case, Transaction is the correct thing to use. Since I am reading a document, and updating it based on the read values, and don't want other writes inbetween, Transaction gives me this guarantee, and automatically retries when there is a conflict, so it has all I need built in to it. So this bug is not a blocker for me.
The node.js API for DocumentReference.update allows an optional second argument, Preconditions. This is missing from the firebase-admin-interop implementation.
The Dart package implements the Precondition object, documents it as used in Transaction, DocumentReference, and WriteBatch, but it is only available in the Transaction.update call, not the other two.
The firestore_binding js DocumentReference collection seems to declare the JS call with the correct arguments:
external Promise update(UpdateData data, [Precondition precondition]);
So it seems like the Dart DocumentReference implementation could just call
nativeInstance.update(docData, _getNativePrecondition(lastUpdateTime))
in the case that an optional Timestamp is passed to it, as is the case with Transaction.
I would like to update documents from DocumentReference, but be sure that I am not overwriting other's changes.
The text was updated successfully, but these errors were encountered: