Cloud Datastore V1 Client - Class Mutation (2.0.3) Stay organized with collections Save and categorize content based on your preferences.
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 \ V1Methods
__construct
Constructor.
| Parameters | |
|---|---|
| Name | Description |
data | arrayOptional. Data for populating the Message object. |
↳ insert | EntityThe entity to insert. The entity must not already exist. The entity key's final path element may be incomplete. |
↳ update | EntityThe entity to update. The entity must already exist. Must have a complete key path. |
↳ upsert | EntityThe entity to upsert. The entity may or may not already exist. The entity key's final path element may be incomplete. |
↳ delete | KeyThe 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_version | int|stringThe 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_time | Google\Protobuf\TimestampThe 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_strategy | intThe strategy to use when a conflict is detected. Defaults to |
↳ property_mask | PropertyMaskThe properties to write in this mutation. None of the properties in the mask may have a reserved name, except for |
↳ property_transforms | array<PropertyTransform>Optional. The transforms to perform on the entity. This field can be set only when the operation is |
getInsert
The entity to insert. The entity must not already exist.
The entity key's final path element may be incomplete.
| Returns | |
|---|---|
| Type | Description |
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 | |
|---|---|
| Name | Description |
var | Entity |
| Returns | |
|---|---|
| Type | Description |
$this | |
getUpdate
The entity to update. The entity must already exist.
Must have a complete key path.
| Returns | |
|---|---|
| Type | Description |
Entity|null | |
hasUpdate
setUpdate
The entity to update. The entity must already exist.
Must have a complete key path.
| Parameter | |
|---|---|
| Name | Description |
var | Entity |
| Returns | |
|---|---|
| Type | Description |
$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 | |
|---|---|
| Type | Description |
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 | |
|---|---|
| Name | Description |
var | Entity |
| Returns | |
|---|---|
| Type | Description |
$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 | |
|---|---|
| Type | Description |
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 | |
|---|---|
| Name | Description |
var | Key |
| Returns | |
|---|---|
| Type | Description |
$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 | |
|---|---|
| Type | Description |
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 | |
|---|---|
| Name | Description |
var | int|string |
| Returns | |
|---|---|
| Type | Description |
$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 | |
|---|---|
| Type | Description |
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 | |
|---|---|
| Name | Description |
var | Google\Protobuf\Timestamp |
| Returns | |
|---|---|
| Type | Description |
$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 | |
|---|---|
| Type | Description |
int | Enum 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 | |
|---|---|
| Name | Description |
var | intEnum of typeConflictResolutionStrategy. |
| Returns | |
|---|---|
| Type | Description |
$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 | |
|---|---|
| Type | Description |
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 | |
|---|---|
| Name | Description |
var | PropertyMask |
| Returns | |
|---|---|
| Type | Description |
$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 | |
|---|---|
| Type | Description |
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 | |
|---|---|
| Name | Description |
var | array<PropertyTransform> |
| Returns | |
|---|---|
| Type | Description |
$this | |
getOperation
| Returns | |
|---|---|
| Type | Description |
string | |
getConflictDetectionStrategy
| Returns | |
|---|---|
| Type | Description |
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.