Cloud Datastore V1 Client - Class Mutation (2.0.3)

Reference documentation and code samples for the Cloud Datastore V1 Client class Mutation.

A mutation to apply to an entity.

Generated from protobuf messagegoogle.datastore.v1.Mutation

Namespace

Google \ Cloud \ Datastore \ V1

Methods

__construct

Constructor.

Parameters
NameDescription
dataarray

Optional. Data for populating the Message object.

↳ insertEntity

The entity to insert. The entity must not already exist. The entity key's final path element may be incomplete.

↳ updateEntity

The entity to update. The entity must already exist. Must have a complete key path.

↳ upsertEntity

The entity to upsert. The entity may or may not already exist. The entity key's final path element may be incomplete.

↳ deleteKey

The key of the entity to delete. The entity may or may not already exist. Must have a complete key path and must not be reserved/read-only.

↳ base_versionint|string

The version of the entity that this mutation is being applied to. If this does not match the current version on the server, the mutation conflicts.

↳ update_timeGoogle\Protobuf\Timestamp

The update time of the entity that this mutation is being applied to. If this does not match the current update time on the server, the mutation conflicts.

↳ conflict_resolution_strategyint

The strategy to use when a conflict is detected. Defaults toSERVER_VALUE. If this is set, thenconflict_detection_strategy must also be set.

↳ property_maskPropertyMask

The properties to write in this mutation. None of the properties in the mask may have a reserved name, except for__key__. This field is ignored fordelete. If the entity already exists, only properties referenced in the mask are updated, others are left untouched. Properties referenced in the mask but not in the entity are deleted.

↳ property_transformsarray<PropertyTransform>

Optional. The transforms to perform on the entity. This field can be set only when the operation isinsert,update, orupsert. If present, the transforms are be applied to the entity regardless of the property mask, in order, after the operation.

getInsert

The entity to insert. The entity must not already exist.

The entity key's final path element may be incomplete.

Returns
TypeDescription
Entity|null

hasInsert

setInsert

The entity to insert. The entity must not already exist.

The entity key's final path element may be incomplete.

Parameter
NameDescription
varEntity
Returns
TypeDescription
$this

getUpdate

The entity to update. The entity must already exist.

Must have a complete key path.

Returns
TypeDescription
Entity|null

hasUpdate

setUpdate

The entity to update. The entity must already exist.

Must have a complete key path.

Parameter
NameDescription
varEntity
Returns
TypeDescription
$this

getUpsert

The entity to upsert. The entity may or may not already exist.

The entity key's final path element may be incomplete.

Returns
TypeDescription
Entity|null

hasUpsert

setUpsert

The entity to upsert. The entity may or may not already exist.

The entity key's final path element may be incomplete.

Parameter
NameDescription
varEntity
Returns
TypeDescription
$this

getDelete

The key of the entity to delete. The entity may or may not already exist.

Must have a complete key path and must not be reserved/read-only.

Returns
TypeDescription
Key|null

hasDelete

setDelete

The key of the entity to delete. The entity may or may not already exist.

Must have a complete key path and must not be reserved/read-only.

Parameter
NameDescription
varKey
Returns
TypeDescription
$this

getBaseVersion

The version of the entity that this mutation is being appliedto. If this does not match the current version on the server, themutation conflicts.

Returns
TypeDescription
int|string

hasBaseVersion

setBaseVersion

The version of the entity that this mutation is being appliedto. If this does not match the current version on the server, themutation conflicts.

Parameter
NameDescription
varint|string
Returns
TypeDescription
$this

getUpdateTime

The update time of the entity that this mutation is being appliedto. If this does not match the current update time on the server, themutation conflicts.

Returns
TypeDescription
Google\Protobuf\Timestamp|null

hasUpdateTime

setUpdateTime

The update time of the entity that this mutation is being appliedto. If this does not match the current update time on the server, themutation conflicts.

Parameter
NameDescription
varGoogle\Protobuf\Timestamp
Returns
TypeDescription
$this

getConflictResolutionStrategy

The strategy to use when a conflict is detected. Defaults toSERVER_VALUE.

If this is set, thenconflict_detection_strategy must also be set.

Returns
TypeDescription
intEnum of typeConflictResolutionStrategy.

setConflictResolutionStrategy

The strategy to use when a conflict is detected. Defaults toSERVER_VALUE.

If this is set, thenconflict_detection_strategy must also be set.

Parameter
NameDescription
varint

Enum of typeConflictResolutionStrategy.

Returns
TypeDescription
$this

getPropertyMask

The properties to write in this mutation.

None of the properties in the mask may have a reserved name, except for__key__.This field is ignored fordelete.If the entity already exists, only properties referenced in the mask areupdated, others are left untouched.Properties referenced in the mask but not in the entity are deleted.

Returns
TypeDescription
PropertyMask|null

hasPropertyMask

clearPropertyMask

setPropertyMask

The properties to write in this mutation.

None of the properties in the mask may have a reserved name, except for__key__.This field is ignored fordelete.If the entity already exists, only properties referenced in the mask areupdated, others are left untouched.Properties referenced in the mask but not in the entity are deleted.

Parameter
NameDescription
varPropertyMask
Returns
TypeDescription
$this

getPropertyTransforms

Optional. The transforms to perform on the entity.

This field can be set only when the operation isinsert,update,orupsert. If present, the transforms are be applied to the entityregardless of the property mask, in order, after the operation.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setPropertyTransforms

Optional. The transforms to perform on the entity.

This field can be set only when the operation isinsert,update,orupsert. If present, the transforms are be applied to the entityregardless of the property mask, in order, after the operation.

Parameter
NameDescription
vararray<PropertyTransform>
Returns
TypeDescription
$this

getOperation

Returns
TypeDescription
string

getConflictDetectionStrategy

Returns
TypeDescription
string

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-24 UTC.