set method

WriteBatch set(
  1. DocumentReference documentRef,
  2. JSObject data, [
  3. SetOptions options
])

Write to the document referred to by the provided DocumentReference. If the document does not exist yet, it will be created. If you pass SetOptions, the provided data can be merged into the existing document.

@param documentRef A reference to the document to be set. @param data An object of the fields and values for the document. @param options An object to configure the set behavior. @param options.merge - If true, set() merges the values specified in its data argument. Fields omitted from this set() call remain untouched. If your input sets any field to an empty map, all nested fields are overwritten. @param options.mergeFields - If provided, set() only replaces the specified field paths. Any field path that is not specified is ignored and remains untouched. If your input sets any field to an empty map, all nested fields are overwritten. @throws Error If the provided input is not a valid Firestore document. @return This WriteBatch instance. Used for chaining method calls.

Implementation

external WriteBatch set(
  DocumentReference documentRef,
  JSObject data, [
  SetOptions options,
]);