[FR] expose Preconditions in the set call for the admin API #1697
Labels
api: firestore
Issues related to the googleapis/nodejs-firestore API.
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
(the Firestore Node Admin API folks sent me over here from firebase/firebase-admin-node#1597)
Describe the problem
The Admin API exposes an
update
method which includes Preconditions. This allows us to specify that a document update call should fail if the DB document was modified after the precondition.updateTime. This is a nice way to make sure that REST API callers don't overwrite documents that were simultaneously modified.Unfortunately, the
set
method does not expose a way to specify a similar Precondition, which means we can only specify Preconditions when updating an existing document, and not when we want to replace it wholesale.Relevant Code:
Workarounds:
(ported over from firebase/firebase-js-sdk#6058 and firebase/firebase-admin-node#1597)
The text was updated successfully, but these errors were encountered: