SetOptions | Doclava
public final class

SetOptions

extends Object
java.lang.Object
   ↳ com.google.firebase.firestore.SetOptions

Class Overview

An options object that configures the behavior of set() calls. By providing one of the SetOptions objects returned by merge(), mergeFields(String...) and mergeFieldPaths(List), the set() calls in DocumentReference, WriteBatch and Transaction can be configured to perform granular merges instead of overwriting the target documents in their entirety.

Summary

Public Methods
boolean equals(Object o)
int hashCode()
static SetOptions merge()
Changes the behavior of set() calls to only replace the values specified in its data argument.
static SetOptions mergeFieldPaths(List<FieldPath> fields)
Changes the behavior of set() calls to only replace the fields under fieldPaths.
static SetOptions mergeFields(List<String> fields)
Changes the behavior of set() calls to only replace the fields under fieldPaths.
static SetOptions mergeFields(String... fields)
Changes the behavior of set() calls to only replace the fields under fieldPaths.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean equals (Object o)

Parameters
o Object

Returns
boolean

public int hashCode ()

Returns
int

public static SetOptions merge ()

Changes the behavior of set() calls to only replace the values specified in its data argument. Fields omitted from the set() call will remain untouched.

Returns
SetOptions

public static SetOptions mergeFieldPaths (List<FieldPath> fields)

Changes the behavior of set() calls to only replace the fields under fieldPaths. Any field that is not specified in fieldPaths is ignored and remains untouched.

It is an error to pass a SetOptions object to a set() call that is missing a value for any of the fields specified here in its to data argument.

Parameters
fields List:The list of fields to merge.

Returns
SetOptions

public static SetOptions mergeFields (List<String> fields)

Changes the behavior of set() calls to only replace the fields under fieldPaths. Any field that is not specified in fieldPaths is ignored and remains untouched.

It is an error to pass a SetOptions object to a set() call that is missing a value for any of the fields specified here.

Parameters
fields List:The list of fields to merge. Fields can contain dots to reference nested fields within the document.

Returns
SetOptions

public static SetOptions mergeFields (String... fields)

Changes the behavior of set() calls to only replace the fields under fieldPaths. Any field that is not specified in fieldPaths is ignored and remains untouched.

It is an error to pass a SetOptions object to a set() call that is missing a value for any of the fields specified here.

Parameters
fields String:The list of fields to merge. Fields can contain dots to reference nested fields within the document.

Returns
SetOptions