# Cloud Firestore V1 Client - Class UpdateDocumentRequest (2.2.0-RC1)

2.2.0-RC1 2.1.0 (latest) 2.0.2-RC1 1.55.0 1.54.4 1.53.1 1.52.0 1.51.0 1.50.0 1.48.1 1.47.3 1.46.0 1.45.2 1.44.1 1.43.3 1.40.0 1.39.0 1.38.0 1.37.7 1.36.1 1.35.0 1.34.0 1.33.0 1.32.0 1.31.0 1.30.0 1.28.0 1.27.3 Reference documentation and code samples for the Cloud Firestore V1 Client class UpdateDocumentRequest.

The request for
Firestore.UpdateDocument.

Generated from protobuf message `google.firestore.v1.UpdateDocumentRequest`

## Namespace

Google \\ Cloud \\ Firestore \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ document` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.Document` Required. The updated document. Creates the document if it does not already exist. |
| `↳ update_mask` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.DocumentMask` The fields to update. None of the field paths in the mask may contain a reserved name. If the document exists on the server and has fields not referenced in the mask, they are left unchanged. Fields referenced in the mask, but not present in the input document, are deleted from the document on the server. |
| `↳ mask` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.DocumentMask` The fields to return. If not set, returns all fields. If the document has a field that is not present in this mask, that field will not be returned in the response. |
| `↳ current_document` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.Precondition` An optional precondition on the document. The request will fail if this is set and not met by the target document. |

### getDocument

Required. The updated document.

Creates the document if it does not already exist.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.Document|null` |   |

### hasDocument

### clearDocument

### setDocument

Required. The updated document.

Creates the document if it does not already exist.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.Document` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpdateMask

The fields to update.

None of the field paths in the mask may contain a reserved name.
If the document exists on the server and has fields not referenced in the
mask, they are left unchanged.
Fields referenced in the mask, but not present in the input document, are
deleted from the document on the server.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.DocumentMask|null` |   |

### hasUpdateMask

### clearUpdateMask

### setUpdateMask

The fields to update.

None of the field paths in the mask may contain a reserved name.
If the document exists on the server and has fields not referenced in the
mask, they are left unchanged.
Fields referenced in the mask, but not present in the input document, are
deleted from the document on the server.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.DocumentMask` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMask

The fields to return. If not set, returns all fields.

If the document has a field that is not present in this mask, that field
will not be returned in the response.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.DocumentMask|null` |   |

### hasMask

### clearMask

### setMask

The fields to return. If not set, returns all fields.

If the document has a field that is not present in this mask, that field
will not be returned in the response.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.DocumentMask` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCurrentDocument

An optional precondition on the document.

The request will fail if this is set and not met by the target document.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.Precondition|null` |   |

### hasCurrentDocument

### clearCurrentDocument

### setCurrentDocument

An optional precondition on the document.

The request will fail if this is set and not met by the target document.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.Precondition` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `document` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.Document` Required. The updated document. Creates the document if it does not already exist. |
| `updateMask` | `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.DocumentMask` The fields to update. None of the field paths in the mask may contain a reserved name. If the document exists on the server and has fields not referenced in the mask, they are left unchanged. Fields referenced in the mask, but not present in the input document, are deleted from the document on the server. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-firestore/latest/V1.UpdateDocumentRequest` |   |