SetOptions

classSetOptions


An options object that configures the behavior ofset() calls. By providing one of the SetOptions objects returned bymerge,mergeFields andmergeFieldPaths, theset() calls inDocumentReference,WriteBatch andTransaction can be configured to perform granular merges instead of overwriting the target documents in their entirety.

Summary

Public functions

Boolean
equals(o: Any!)
Int
java-staticSetOptions

Changes the behavior ofset() calls to only replace the values specified in its data argument.

java-staticSetOptions

Changes the behavior ofset() calls to only replace the given fields.

java-staticSetOptions
mergeFields(fields: Array<String!>!)

Changes the behavior ofset() calls to only replace the given fields.

java-staticSetOptions

Changes the behavior ofset() calls to only replace the given fields.

Public properties

FieldMask?

Public functions

equals

fun equals(o: Any!): Boolean

hashCode

fun hashCode(): Int

merge

java-static fun merge(): SetOptions

Changes the behavior ofset() calls to only replace the values specified in its data argument. Fields omitted from theset() call will remain untouched. If your input sets any field to an empty map, all nested fields are overwritten.

mergeFieldPaths

java-static fun mergeFieldPaths(fields: (Mutable)List<FieldPath!>): SetOptions

Changes the behavior ofset() calls to only replace the given fields. Any field that is not specified infields is ignored and remains untouched.

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

Parameters
fields: (Mutable)List<FieldPath!>

The list of fields to merge.

mergeFields

java-static fun mergeFields(fields: Array<String!>!): SetOptions

Changes the behavior ofset() calls to only replace the given fields. Any field that is not specified infields is ignored and remains untouched.

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

Parameters
fields: Array<String!>!

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

mergeFields

java-static fun mergeFields(fields: (Mutable)List<String!>): SetOptions

Changes the behavior ofset() calls to only replace the given fields. Any field that is not specified infields is ignored and remains untouched. If your input sets any field to an empty map, all nested fields are overwritten.

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

Parameters
fields: (Mutable)List<String!>

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

Public properties

fieldMask

val fieldMaskFieldMask?

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.