set method

JSPromise<WriteResult> set(
  1. JSObject data, [
  2. SetOptions options
])

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

@param data A map 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 A Promise resolved with the write time of this set.

Implementation

external JSPromise<WriteResult> set(
  JSObject data, [
  SetOptions options,
]);