Cloud Firestore V1 Client - Class UpdateDocumentRequest (1.44.1)

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 Google\Cloud\Firestore\V1\Document

Required. The updated document. Creates the document if it does not already exist.

↳ update_mask Google\Cloud\Firestore\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 Google\Cloud\Firestore\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 Google\Cloud\Firestore\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
Google\Cloud\Firestore\V1\Document|null

hasDocument

clearDocument

setDocument

Required. The updated document.

Creates the document if it does not already exist.

Parameter
Name Description
var Google\Cloud\Firestore\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
Google\Cloud\Firestore\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 Google\Cloud\Firestore\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
Google\Cloud\Firestore\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 Google\Cloud\Firestore\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
Google\Cloud\Firestore\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 Google\Cloud\Firestore\V1\Precondition
Returns
Type Description
$this

static::build

Parameters
Name Description
document Google\Cloud\Firestore\V1\Document

Required. The updated document. Creates the document if it does not already exist.

updateMask Google\Cloud\Firestore\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
Google\Cloud\Firestore\V1\UpdateDocumentRequest