# Cloud Firestore V1 API - Class Google::Cloud::Firestore::V1::Write (v2.4.0)

2.4.0 (latest) 2.3.0 2.2.1 2.1.1 2.0.1 1.3.0 1.2.0 1.1.1 1.0.0 0.14.0 0.13.0 0.12.0 0.11.1 0.10.0 0.9.0 0.8.0 0.7.1 0.6.0 0.5.0 0.4.8 Reference documentation and code samples for the Cloud Firestore V1 API class Google::Cloud::Firestore::V1::Write.

A write on a document.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #current_document

    def current_document() -> ::Google::Cloud::Firestore::V1::Precondition

**Returns**

- ([::Google::Cloud::Firestore::V1::Precondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Precondition)) --- An optional precondition on the document.


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

### #current_document=

    def current_document=(value) -> ::Google::Cloud::Firestore::V1::Precondition

**Parameter**

- **value** ([::Google::Cloud::Firestore::V1::Precondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Precondition)) --- An optional precondition on the document.


  The write will fail if this is set and not met by the target document.
**Returns**

- ([::Google::Cloud::Firestore::V1::Precondition](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Precondition)) --- An optional precondition on the document.


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

### #delete

    def delete() -> ::String

**Returns**

- (::String) --- A document name to delete. In the format: `projects/{project_id}/databases/{database_id}/documents/{document_path}`.


  Note: The following fields are mutually exclusive: `delete`, `update`, `transform`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #delete=

    def delete=(value) -> ::String

**Parameter**

- **value** (::String) --- A document name to delete. In the format: `projects/{project_id}/databases/{database_id}/documents/{document_path}`.


  Note: The following fields are mutually exclusive: `delete`, `update`, `transform`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- (::String) --- A document name to delete. In the format: `projects/{project_id}/databases/{database_id}/documents/{document_path}`.


  Note: The following fields are mutually exclusive: `delete`, `update`, `transform`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #transform

    def transform() -> ::Google::Cloud::Firestore::V1::DocumentTransform

**Returns**

- ([::Google::Cloud::Firestore::V1::DocumentTransform](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentTransform)) --- Applies a transformation to a document.


  Note: The following fields are mutually exclusive: `transform`, `update`, `delete`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #transform=

    def transform=(value) -> ::Google::Cloud::Firestore::V1::DocumentTransform

**Parameter**

- **value** ([::Google::Cloud::Firestore::V1::DocumentTransform](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentTransform)) --- Applies a transformation to a document.


  Note: The following fields are mutually exclusive: `transform`, `update`, `delete`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Firestore::V1::DocumentTransform](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentTransform)) --- Applies a transformation to a document.


  Note: The following fields are mutually exclusive: `transform`, `update`, `delete`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #update

    def update() -> ::Google::Cloud::Firestore::V1::Document

**Returns**

- ([::Google::Cloud::Firestore::V1::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Document)) --- A document to write.


  Note: The following fields are mutually exclusive: `update`, `delete`, `transform`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #update=

    def update=(value) -> ::Google::Cloud::Firestore::V1::Document

**Parameter**

- **value** ([::Google::Cloud::Firestore::V1::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Document)) --- A document to write.


  Note: The following fields are mutually exclusive: `update`, `delete`, `transform`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::Firestore::V1::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-Document)) --- A document to write.


  Note: The following fields are mutually exclusive: `update`, `delete`, `transform`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #update_mask

    def update_mask() -> ::Google::Cloud::Firestore::V1::DocumentMask

**Returns**

- ([::Google::Cloud::Firestore::V1::DocumentMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentMask)) --- The fields to update in this write.


  This field can be set only when the operation is `update`.
  If the mask is not set for an `update` and the document exists, any
  existing data will be overwritten.
  If the mask is set and the document on the server has fields not covered by
  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.
  The field paths in this mask must not contain a reserved field name.

### #update_mask=

    def update_mask=(value) -> ::Google::Cloud::Firestore::V1::DocumentMask

**Parameter**

- **value** ([::Google::Cloud::Firestore::V1::DocumentMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentMask)) --- The fields to update in this write.


  This field can be set only when the operation is `update`.
  If the mask is not set for an `update` and the document exists, any
  existing data will be overwritten.
  If the mask is set and the document on the server has fields not covered by
  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.
  The field paths in this mask must not contain a reserved field name.
**Returns**

- ([::Google::Cloud::Firestore::V1::DocumentMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentMask)) --- The fields to update in this write.


  This field can be set only when the operation is `update`.
  If the mask is not set for an `update` and the document exists, any
  existing data will be overwritten.
  If the mask is set and the document on the server has fields not covered by
  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.
  The field paths in this mask must not contain a reserved field name.

### #update_transforms

    def update_transforms() -> ::Array<::Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform>

**Returns**

- (::Array\<[::Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentTransform-FieldTransform)\>) --- The transforms to perform after update.


  This field can be set only when the operation is `update`. If present, this
  write is equivalent to performing `update` and `transform` to the same
  document atomically and in order.

### #update_transforms=

    def update_transforms=(value) -> ::Array<::Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform>

**Parameter**

- **value** (::Array\<[::Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentTransform-FieldTransform)\>) --- The transforms to perform after update.


  This field can be set only when the operation is `update`. If present, this
  write is equivalent to performing `update` and `transform` to the same
  document atomically and in order.
**Returns**

- (::Array\<[::Google::Cloud::Firestore::V1::DocumentTransform::FieldTransform](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-firestore-v1/latest/Google-Cloud-Firestore-V1-DocumentTransform-FieldTransform)\>) --- The transforms to perform after update.


  This field can be set only when the operation is `update`. If present, this
  write is equivalent to performing `update` and `transform` to the same
  document atomically and in order.