Entity Property Reference

Google Cloud Datastore supports a variety of data types for property values. These include, among others:

  • Integers
  • Floating-point numbers
  • Strings
  • Dates
  • Binary data

For a full list of types, see Properties and value types.

Properties and value types

The data values associated with an entity consist of one or more properties. Each property has a name and one or more values. A property can have values of more than one type, and two entities can have values of different types for the same property. Properties can be indexed or unindexed (queries that order or filter on a property P will ignore entities where P is unindexed). An entity can have at most 20,000 indexed properties.

The following value types are supported:

Value type Go type(s) Sort order Notes
Integer int
int8
int16
int32
int64
Numeric 64-bit integer, signed
Floating-point number float32
float64
Numeric 64-bit double precision,
IEEE 754
Boolean bool false<true
String (short) string Unicode
Up to 1500 bytes
String (long) string (with noindex) None Up to 1 megabyte

Not indexed
Byte slice (short) datastore.ByteString Byte order Up to 1500 bytes
Byte slice (long) []byte None Up to 1 megabyte

Not indexed
Date and time time.Time Chronological
Geographical point appengine.GeoPoint By latitude,
then longitude
Cloud Datastore key *datastore.Key By path elements
(kind, identifier,
kind, identifier...)
Blobstore key appengine.BlobKey Byte order

You can also use a struct or slice to aggregate properties. See the Cloud Datastore reference for more details.

When a query involves a property with values of mixed types, Cloud Datastore uses a deterministic ordering based on the internal representations:

  1. Null values
  2. Fixed-point numbers
    • Integers
    • Dates and times
  3. Boolean values
  4. Byte sequences
    • Byte slices (short)
    • Unicode string
    • Blobstore keys
  5. Floating-point numbers
  6. Geographical points
  7. Cloud Datastore keys

Because long byte slices and long strings are not indexed, they have no ordering defined.

Send feedback about...

App Engine standard environment for Go