An options object that configures the behavior of set() calls. By providing one of the SetOptions
objects returned by #merge, #mergeFields and #mergeFieldPaths, the set()
calls in DocumentReference, WriteBatch and Transaction can be configured
to perform granular merges instead of overwriting the target documents in their entirety.
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.
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.
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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Class SetOptions (3.32.1)\n\nVersion latestkeyboard_arrow_down\n\n- [3.32.1 (latest)](/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.SetOptions)\n- [3.32.0](/java/docs/reference/google-cloud-firestore/3.32.0/com.google.cloud.firestore.SetOptions)\n- [3.31.9](/java/docs/reference/google-cloud-firestore/3.31.9/com.google.cloud.firestore.SetOptions)\n- [3.30.11](/java/docs/reference/google-cloud-firestore/3.30.11/com.google.cloud.firestore.SetOptions)\n- [3.28.0](/java/docs/reference/google-cloud-firestore/3.28.0/com.google.cloud.firestore.SetOptions)\n- [3.27.2](/java/docs/reference/google-cloud-firestore/3.27.2/com.google.cloud.firestore.SetOptions)\n- [3.26.5](/java/docs/reference/google-cloud-firestore/3.26.5/com.google.cloud.firestore.SetOptions)\n- [3.25.1](/java/docs/reference/google-cloud-firestore/3.25.1/com.google.cloud.firestore.SetOptions)\n- [3.24.3](/java/docs/reference/google-cloud-firestore/3.24.3/com.google.cloud.firestore.SetOptions)\n- [3.22.0](/java/docs/reference/google-cloud-firestore/3.22.0/com.google.cloud.firestore.SetOptions)\n- [3.21.4](/java/docs/reference/google-cloud-firestore/3.21.4/com.google.cloud.firestore.SetOptions)\n- [3.20.0](/java/docs/reference/google-cloud-firestore/3.20.0/com.google.cloud.firestore.SetOptions)\n- [3.17.0](/java/docs/reference/google-cloud-firestore/3.17.0/com.google.cloud.firestore.SetOptions)\n- [3.16.3](/java/docs/reference/google-cloud-firestore/3.16.3/com.google.cloud.firestore.SetOptions)\n- [3.15.7](/java/docs/reference/google-cloud-firestore/3.15.7/com.google.cloud.firestore.SetOptions)\n- [3.14.4](/java/docs/reference/google-cloud-firestore/3.14.4/com.google.cloud.firestore.SetOptions)\n- [3.13.2](/java/docs/reference/google-cloud-firestore/3.13.2/com.google.cloud.firestore.SetOptions)\n- [3.12.1](/java/docs/reference/google-cloud-firestore/3.12.1/com.google.cloud.firestore.SetOptions)\n- [3.11.0](/java/docs/reference/google-cloud-firestore/3.11.0/com.google.cloud.firestore.SetOptions)\n- [3.10.0](/java/docs/reference/google-cloud-firestore/3.10.0/com.google.cloud.firestore.SetOptions)\n- [3.9.6](/java/docs/reference/google-cloud-firestore/3.9.6/com.google.cloud.firestore.SetOptions)\n- [3.8.2](/java/docs/reference/google-cloud-firestore/3.8.2/com.google.cloud.firestore.SetOptions)\n- [3.7.10](/java/docs/reference/google-cloud-firestore/3.7.10/com.google.cloud.firestore.SetOptions)\n- [3.6.0](/java/docs/reference/google-cloud-firestore/3.6.0/com.google.cloud.firestore.SetOptions)\n- [3.5.0](/java/docs/reference/google-cloud-firestore/3.5.0/com.google.cloud.firestore.SetOptions)\n- [3.4.2](/java/docs/reference/google-cloud-firestore/3.4.2/com.google.cloud.firestore.SetOptions)\n- [3.3.0](/java/docs/reference/google-cloud-firestore/3.3.0/com.google.cloud.firestore.SetOptions)\n- [3.2.0](/java/docs/reference/google-cloud-firestore/3.2.0/com.google.cloud.firestore.SetOptions)\n- [3.1.0](/java/docs/reference/google-cloud-firestore/3.1.0/com.google.cloud.firestore.SetOptions)\n- [3.0.21](/java/docs/reference/google-cloud-firestore/3.0.21/com.google.cloud.firestore.SetOptions) \n\n public final class SetOptions\n\nAn options object that configures the behavior of set() calls. By providing one of the SetOptions\nobjects returned by [#merge](/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.SetOptions#com_google_cloud_firestore_SetOptions_merge_), [#mergeFields](/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.SetOptions#com_google_cloud_firestore_SetOptions_mergeFields_) and [#mergeFieldPaths](/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.SetOptions#com_google_cloud_firestore_SetOptions_mergeFieldPaths_), the set()\ncalls in [DocumentReference](/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference), [WriteBatch](/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.WriteBatch) and [Transaction](/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Transaction) can be configured\nto perform granular merges instead of overwriting the target documents in their entirety. \n\nInheritance\n-----------\n\n[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e SetOptions \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nStatic Methods\n--------------\n\n### merge()\n\n public static SetOptions merge()\n\nChanges the behavior of set() calls to only replace the values specified in its data argument.\nFields with no corresponding values in the data passed to set() will remain untouched.\n\n### mergeFieldPaths(List\\\u003cFieldPath\\\u003e fields)\n\n public static SetOptions mergeFieldPaths(List\u003cFieldPath\u003e fields)\n\nChanges the behavior of set() calls to only replace the fields under fieldPaths. Any field that\nis not specified in fieldPaths is ignored and remains untouched.\n\nIt is an error to pass a SetOptions object to a set() call that is missing a value for any\nof the fields specified here in its to data argument.\n\n### mergeFields(String\\[\\] fields)\n\n public static SetOptions mergeFields(String[] fields)\n\nChanges the behavior of set() calls to only replace the fields under fieldPaths. Any field that\nis not specified in fieldPaths is ignored and remains untouched.\n\nIt is an error to pass a SetOptions object to a set() call that is missing a value for any\nof the fields specified here.\n\n### mergeFields(List\\\u003cString\\\u003e fields)\n\n public static SetOptions mergeFields(List\u003cString\u003e fields)\n\nChanges the behavior of set() calls to only replace the fields under fieldPaths. Any field that\nis not specified in fieldPaths is ignored and remains untouched.\n\nIt is an error to pass a SetOptions object to a set() call that is missing a value for any\nof the fields specified here.\n\nMethods\n-------\n\n### equals(Object obj)\n\n public boolean equals(Object obj)\n\nReturns true if this SetOptions is equal to the provided object.\n\n**Overrides** \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-)\n\n### hashCode()\n\n public int hashCode()\n\n**Overrides** \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--)"]]