Package com.google.cloud.firestore
Class SetOptions
java.lang.Object
com.google.cloud.firestore.SetOptions
An options object that configures the behavior of set() calls. By providing one of the SetOptions
objects returned by
merge, mergeFields(java.util.List<java.lang.String>) and mergeFieldPaths(java.util.List<com.google.cloud.firestore.FieldPath>), the set()
calls in DocumentReference, WriteBatch and Transaction can be configured
to perform granular merges instead of overwriting the target documents in their entirety.-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if this SetOptions is equal to the provided object.inthashCode()static SetOptionsmerge()Changes the behavior of set() calls to only replace the values specified in its data argument.static SetOptionsmergeFieldPaths(List<FieldPath> fields) Changes the behavior of set() calls to only replace the fields under fieldPaths.static SetOptionsmergeFields(String... fields) Changes the behavior of set() calls to only replace the fields under fieldPaths.static SetOptionsmergeFields(List<String> fields) Changes the behavior of set() calls to only replace the fields under fieldPaths.
-
Method Details
-
merge
Changes the behavior of set() calls to only replace the values specified in its data argument. Fields with no corresponding values in the data passed to set() will remain untouched. -
mergeFields
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- The list of fields to merge. Fields can contain dots to reference nested fields within the document.
-
mergeFields
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- The list of fields to merge. Fields can contain dots to reference nested fields within the document.
-
mergeFieldPaths
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- The list of fields to merge.
-
equals
Returns true if this SetOptions is equal to the provided object. -
hashCode
public int hashCode()
-