updateFieldPath method

  1. @JS('update')
JSPromise<WriteResult> updateFieldPath(
  1. DocumentReference documentRef,
  2. JSAny field,
  3. JSObject value, [
  4. JSArray<JSAny> precondition,
])

Update fields of the document referred to by the provided DocumentReference{@link DocumentReference}. If the document doesn't yet exist, the update fails and the entire batch will be rejected.

The update() method accepts either an object with field paths encoded as keys and field values encoded as values, or a variable number of arguments that alternate between field paths and field values. Nested fields can be updated by providing dot-separated field path strings or by providing FieldPath objects.

A Precondition restricting this update can be specified as the last argument.

@param documentRef A reference to the document to be updated. @param field The first field to update. @param value The first value @param fieldsOrPrecondition An alternating list of field paths and values to update, optionally followed a Precondition to enforce on this update. @throws Error If the provided input is not valid Firestore data; @returns A promise that resolves with the result of the write. If the write fails, the promise is rejected with a BulkWriterError{@link BulkWriterError}.

Implementation

@JS('update')
external JSPromise<WriteResult> updateFieldPath(
  DocumentReference documentRef,
  JSAny field,
  JSObject value, [
  JSArray<JSAny> precondition,
]);