# Class UpdateBuilder&lt;T&gt; (3.43.1)

3.43.1 (latest) 3.41.0 3.38.0 3.37.0 3.36.0 3.35.1 3.33.4 3.32.2 3.31.9 3.30.11 3.28.0 3.27.2 3.26.5 3.25.1 3.24.3 3.22.0 3.21.4 3.20.0 3.17.0 3.16.3 3.15.7 3.14.4 3.13.2 3.12.1 3.11.0 3.10.0 3.9.6 3.8.2 3.7.10 3.6.0 3.5.0 3.4.2 3.3.0 3.2.0 3.1.0 3.0.21

    public abstract class UpdateBuilder<T>

Abstract class that collects and bundles all write operations for [Transaction](https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Transaction) and [WriteBatch](https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.WriteBatch).

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> UpdateBuilder\<T\>

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `T` |   |

## Fields

### committed

    protected volatile boolean committed

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

## Methods

### className()

    protected String className()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### create(DocumentReference documentReference, Object pojo)

    public T create(DocumentReference documentReference, Object pojo)

Creates a new Document at the DocumentReference location. It fails the write if the document
exists.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to create. |
| `pojo` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` The POJO that will be used to populate the document contents. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### create(DocumentReference documentReference, Map\<String,Object\> fields)

    public T create(DocumentReference documentReference, Map<String,Object> fields)

Creates a new Document at the DocumentReference's location. It fails the write if the document
exists.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to create. |
| `fields` | `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>` A map of the fields and values for the document. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### delete(DocumentReference documentReference)

    public T delete(DocumentReference documentReference)

Deletes the document referred to by this DocumentReference.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to delete. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### delete(DocumentReference documentReference, Precondition precondition)

    public T delete(DocumentReference documentReference, Precondition precondition)

Deletes the document referred to by this DocumentReference.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to delete. |
| `precondition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Precondition` Precondition for the delete operation. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### getMutationsSize()

    public int getMutationsSize()

Get the number of writes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### set(DocumentReference documentReference, Object pojo)

    public T set(DocumentReference documentReference, Object pojo)

Overwrites the document referred to by this DocumentReference. If the document doesn't exist
yet, it will be created. If a document already exists, it will be overwritten.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to overwrite. |
| `pojo` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` The POJO that will be used to populate the document contents. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### set(DocumentReference documentReference, Object pojo, SetOptions options)

    public T set(DocumentReference documentReference, Object pojo, SetOptions options)

Overwrites the document referred to by this DocumentReference. If the document doesn't exist
yet, it will be created. If you pass [SetOptions](https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.SetOptions), the provided data can be merged into
an existing document.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to overwrite. |
| `pojo` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` The POJO that will be used to populate the document contents. |
| `options` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.SetOptions` An object to configure the set behavior. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### set(DocumentReference documentReference, Map\<String,Object\> fields)

    public T set(DocumentReference documentReference, Map<String,Object> fields)

Overwrites the document referred to by this DocumentReference. If the document doesn't exist
yet, it will be created. If a document already exists, it will be overwritten.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to overwrite. |
| `fields` | `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>` A map of the field paths and values for the document. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### set(DocumentReference documentReference, Map\<String,Object\> fields, SetOptions options)

    public T set(DocumentReference documentReference, Map<String,Object> fields, SetOptions options)

Overwrites the document referred to by this DocumentReference. If the document doesn't exist
yet, it will be created. If you pass [SetOptions](https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.SetOptions), the provided data can be merged into
an existing document.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to overwrite. |
| `fields` | `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>` A map of the field paths and values for the document. |
| `options` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.SetOptions` An object to configure the set behavior. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### toString()

    public String toString()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)

### update(DocumentReference documentReference, FieldPath fieldPath, Object value, Object\[\] moreFieldsAndValues)

    public T update(DocumentReference documentReference, FieldPath fieldPath, Object value, Object[] moreFieldsAndValues)

Updates the fields in the document referred to by this DocumentReference. If the document
doesn't exist yet, the update will fail.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to update. |
| `fieldPath` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldPath` The first field to set. |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` The first value to set. |
| `moreFieldsAndValues` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html[]` String and Object pairs with more fields to be set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### update(DocumentReference documentReference, Precondition precondition, FieldPath fieldPath, Object value, Object\[\] moreFieldsAndValues)

    public T update(DocumentReference documentReference, Precondition precondition, FieldPath fieldPath, Object value, Object[] moreFieldsAndValues)

Updates the fields in the document referred to by this DocumentReference. If the document
doesn't exist yet, the update will fail.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to update. |
| `precondition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Precondition` Precondition to enforce on this update. |
| `fieldPath` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.FieldPath` The first field to set. |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` The first value to set. |
| `moreFieldsAndValues` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html[]` String and Object pairs with more fields to be set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### update(DocumentReference documentReference, Precondition precondition, String field, Object value, Object\[\] moreFieldsAndValues)

    public T update(DocumentReference documentReference, Precondition precondition, String field, Object value, Object[] moreFieldsAndValues)

Updates the fields in the document referred to by this DocumentReference. If the document
doesn't exist yet, the update will fail.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to update. |
| `precondition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Precondition` Precondition to enforce on this update. |
| `field` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The first field to set. |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` The first value to set. |
| `moreFieldsAndValues` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html[]` String and Object pairs with more fields to be set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### update(DocumentReference documentReference, String field, Object value, Object\[\] moreFieldsAndValues)

    public T update(DocumentReference documentReference, String field, Object value, Object[] moreFieldsAndValues)

Updates the fields in the document referred to by this DocumentReference. If the document
doesn't exist yet, the update will fail.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to update. |
| `field` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The first field to set. |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` The first value to set. |
| `moreFieldsAndValues` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html[]` String and Object pairs with more fields to be set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### update(DocumentReference documentReference, Map\<String,Object\> fields)

    public T update(DocumentReference documentReference, Map<String,Object> fields)

Updates fields in the document referred to by this DocumentReference. If the document doesn't
exist yet, the update will fail.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to update. |
| `fields` | `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>` A Map containing the fields and values with which to update the document. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |

### update(DocumentReference documentReference, Map\<String,Object\> fields, Precondition precondition)

    public T update(DocumentReference documentReference, Map<String,Object> fields, Precondition precondition)

Updates fields in the document referred to by this DocumentReference. If the document doesn't
exist yet, the update will fail.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `documentReference` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.DocumentReference` The DocumentReference to update. |
| `fields` | `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>` A Map containing the fields and values with which to update the document. |
| `precondition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-firestore/latest/com.google.cloud.firestore.Precondition` Precondition to enforce on this update. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | The instance for chaining. |