Field Types

Learn about available field types for your models.

Default

Every model type is pre-defined with created and modified timestamp fields. These are automatically managed.

Primitive

code

Maximum length: 100 UTF-8 characters. May be marked as unique: true.
Provisioned size: 400 bytes (4 bytes provisioned per character).

boolean

true/false boolean value.
Provisioned size: 1 byte.

integer

Non-floating 64 bit integer (long).
Provisioned size: 8 bytes.

double

Floating-point number (64-bit double precision, IEEE 754).
Provisioned size: 8 bytes.

timestamp

Date/time stored as UTC/GMT. Keep in mind that every model comes with automatically managed created and modified timestamp fields.
Provisioned size: 8 bytes.
To initialize a timestamp field to the current date/time use init: true.

Options

options are a special purpose string field, limited to pre-configured string values. The options / values must be camel case (example, exampleOne, exampleTwoOther), using single byte letters.
Provisioned size: 50 bytes.

Example

status:
  type: options
  optional: true
  init: false
  values:
    - pending
    - disabled
    - active

Initialization

To use the first listed value as a default / pre-initialized value for newly created models, simply change init to true. Otherwise it will default to null.

Type-Safe Access

Instead of referencing the available values by string, it's recommend to use the type-safe version. Given a Product model:

let p = new Product().status(Product.status.pending);

Speciality

Speciality fields provide validation, and often lower provisioned sizes.

country

ISO 3166-1 alpha-3 country code.
Provisioned size: 3 bytes.

map

Special case field that should be used sparingly. Maps support free-form string, number, and boolean values. Maps are not indexed, and not queryable. They are only suitable for free-form fields that may vary widely for the same model type.

Image

The image field type stores a single image. Supported image types are JPG, GIF, PNG. For more information on uploading and displaying images, see Models / Images.
Provisioned size: 100 bytes (independent of image size)

Maximum Size

Upload sizes of up to 10MB are accepted. However images that exceed 2000px wide will be proportionally re-sized to 2000px wide with a proportional height. The size of an image does not contribute to the size of a model.

Example Definition

coverImage: image

Hierarchy

hierarchy is a specialized field type which enables custom ordering of the Universal model type.

This field may only be named "hierarchy" or "order", and a model may only contain one field of this type. For more information on using this field type see Models / Ordering.

Example Definition

order: hierarchy

Provisioned size: 50 bytes.

SVG Icon

svg-icon is a purpose specific field for holding a web-safe, square SVG icon. Typically these values are generated from the Identicon utility. This field is highly constrained to valid and safe SVG. No scripting or inline styles are allowed.
Maximum and provisioned size: 2000 bytes.

Example Definition

projectIcon: svg-icon

To display an SVG field in Mustache, use triple brackets {{{ model.textField }}}.

Rich Text / HTML

text

Limited and validated HTML "rich text".

Supports a series of blocks h1-h6, p, pre, section, blockquote, ul/li, ol/li. section must contain h1-h6 as its first child.

Within each block, the following inline elements are supported: a, br, code, em, s, strong, sub, sup.

Provisioned and maximum size is 20,000 bytes for the Content Type, and 2,000 bytes for all other types.

title

Special kind of text which is limited to a single h1-h6 block containing allowed inline elements.
Maximum length: 100 UTF-8 characters. Provisioned size: 400 bytes (4 bytes provisioned per character).

Display

To display an HTML field in Mustache, use triple brackets {{{ model.titleOrTextField }}} to ensure it is not escaped.

Embedded

This is the field type corresponding to a complex value defined by an Embedded model type.

It may be a many valued array/list, in which case there is a limit of 20 embedded entries.

Provisioned size: sum of provisioned field sizes * times number of possible entries.

For more information on defining an embedded field, click here.

Unique Values

The string field type may be marked as unique for the Universal model type only. Unique values are constrained/scoped to the nearest container.

Deleting a document will delete all associated unique values.

Warning: Commits will fail / throw an exception if there is a unique value violation. Therefore it's highly recommended that if a unique value is being created or changing, that there exists logic to check whether the unique value is available.

URL Identifiers

uid is used for "user friendly" unique identifiers destined for URL paths (aka URL slugs).

This field is always unique, and is available for the Universal and Content type's.

To keep URLs formatted according to best practices, it must start and end with a lower case character a-z, or 0-9. Between the start and end, dash characters are also allowed. Minimum length is 2 characters. Maximum length is 100 characters.

UID's behave differently than other unique values. Because they are destined for URLs, it's implied that when modified the previous value is not lost (otherwise any previously published URL would result in a broken link). Therefore a single model field may have multiple unique UID values associated with it, however at any given time only one is "current" or "primary".

In an ideal scenario from an SEO standpoint, if the visitor has reached a URL by an older UID, then it's recommended you redirect to the current/primary UID value. When using dynamic endpoints backed by a UID field, this redirection is handled automatically.

Provisioned size: 100 bytes.