A Datastore entity ( detailed presentation ) is uniquely identified by a key and has one or more named properties, each of which can have one or more values. Entities of the same kind need not have the same properties, and an entity's values for a given property need not all be of the same data type.
An entity is represented in JSON by an object with the following structure:
{ "key": { "partitionId": { "datasetId": string, "namespace": string }, "path": [ { "kind": string, "id": long, "name": string } ] }, "properties": { (key): { "booleanValue": boolean, "integerValue": long, "doubleValue": double, "dateTimeValue": datetime, "keyValue": { "partitionId": { "datasetId": string, "namespace": string }, "path": [ { "kind": string, "id": long, "name": string } ] }, "blobKeyValue": string, "stringValue": string, "blobValue": bytes, "entityValue": (Entity), "listValue": [ { "booleanValue": boolean, "integerValue": long, "doubleValue": double, "dateTimeValue": datetime, "keyValue": { "partitionId": { "datasetId": string, "namespace": string }, "path": [ { "kind": string, "id": long, "name": string } ] }, "blobKeyValue": string, "stringValue": string, "blobValue": bytes, "entityValue": (Entity), "listValue": [ (Value) ], "meaning": integer, "indexed": boolean } ], "meaning": integer, "indexed": boolean } } }
Property name | Value | Description | Notes |
---|---|---|---|
key
|
nested object
|
The entity's key.
An entity must have a key, unless otherwise documented (for example, an entity in
Value.entityValue
may have no key). An entity's kind is its key's path's last element's kind, or null if it has no key.
|
|
key.
partitionId
|
nested object
|
Entities are partitioned into subsets, currently identified by a dataset (usually implicitly specified by the project) and namespace ID. Queries are scoped to a single partition. | |
key.partitionId.
datasetId
|
string
|
The dataset ID. | |
key.partitionId.
namespace
|
string
|
The namespace. | |
key.
path[]
|
list
|
The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity , the second element identifies a child of the root entity, the third element a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors . An entity path is always fully complete: ALL of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. A path can never be empty. | |
key.path[].
kind
|
string
|
The kind of the entity. Kinds matching regex "__.*__" are reserved/read-only. Cannot be "". | |
key.path[].
id
|
long
|
The ID of the entity. Always > 0. | |
key.path[].
name
|
string
|
The name of the entity. Names matching regex "__.*__" are reserved/read-only. Cannot be "". | |
properties
|
object
|
The entity's properties. | |
properties.
(key)
|
nested object
|
The name of the property. A property name matching regex "__.*__" is reserved. A reserved property name is forbidden in certain documented contexts. The name must not contain more than 500 characters. Cannot be "". | |
properties.(key).
booleanValue
|
boolean
|
A boolean value. | |
properties.(key).
integerValue
|
long
|
An integer value. | |
properties.(key).
doubleValue
|
double
|
A double value. | |
properties.(key).
dateTimeValue
|
datetime
|
A timestamp value. | |
entity[].properties.(key).
keyValue
|
nested object
|
A key value. | |
properties.(key).keyValue.
partitionId
|
nested object
|
Entities are partitioned into subsets, currently identified by a dataset (usually implicitly specified by the project) and namespace ID. Queries are scoped to a single partition. | |
properties.(key).keyValue.partitionId.
datasetId
|
string
|
The dataset ID. | |
properties.(key).keyValue.partitionId.
namespace
|
string
|
The namespace. | |
properties.(key).keyValue.
path[]
|
list
|
The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element identifies a root entity , the second element identifies a child of the root entity, the third element a child of the second entity, and so forth. The entities identified by all prefixes of the path are called the element's ancestors . An entity path is always fully complete: ALL of the entity's ancestors are required to be in the path along with the entity identifier itself. The only exception is that in some documented cases, the identifier in the last path element (for the entity) itself may be omitted. A path can never be empty. | |
properties.(key).keyValue.path[].
kind
|
string
|
The kind of the entity. A kind matching regex "__.*__" is reserved/read-only. A kind must not contain more than 500 characters. Cannot be "". | |
properties.(key).keyValue.path[].
id
|
long
|
The ID of the entity. Never equal to zero. Values less than zero are discouraged and will not be supported in the future. | |
properties.(key).keyValue.path[].
name
|
string
|
The name of the entity. A name matching regex "__.*__" is reserved/read-only. A name must not be more than 500 characters. Cannot be "". |