Skip to content

firestore DocumentReference.update does not support Preconditions #48

@whesse

Description

@whesse

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions