Object Properties

The following sections describe the possible types of custom properties you can add to an object definition.

Base Property Options

The following base options are available when defining properties, unless otherwise noted. See individual properties for additional property-specific options.

*Bold options are required*

Name

Type

Default

Description

name

String

API name of property.

label

String

Property label that can be used in UI.

type

String

The property type. See individual property type details for more info.

description

String

Property description. This can be used for UI or for administrative purposes.

array

Boolean

false

If true, this property is an array of this type rather than a single value. This option can only be set when creating the property and cannot be changed.

uniqueValues

Boolean

false

Applies only if array: true. If true, values in array are guaranteed to be unique.

minItems

Integer

0

Applies only if array: true. The minimum number of items required in the array. Set to 0 for no minimum.

maxItems

Integer

100

Applies only if array: true. The maximum number of items allowed in the array. Cannot be greater than 1000.

maxShift

Boolean

false

Applies only if array: true. When true, shifts older items off of front of array when max items is reached rather than producing a kMaxAllowed fault.

canPush

Boolean

true

Applies only if array: true. If true, POST operations on the property can push values into the array.

canPull

Boolean

true

Applies only if array: true. If true, DELETE operations on property can remove items from the array by value or by array element _id

writeOnCreate

Boolean

true

Applies only if array: true. Allow values to be written to property array on document create.

readAccess

Integer

4

The access level require to read this property. See Access Control for available values.

writeAccess

Integer

6

The access level require to write to this property. See Access Control for available values.

acl

Document Array

Allows additional ACL to be specified for property. This acl merges with runtime acl to increase access to this property. Additive only -- these acl entries cannot lessen access to this property.

auditable

Boolean

false

When true, changes to this property will result in a record in the audit logs.

readable

Boolean

true

Allow this property to be read. When false, this property is not available through the API and is only available through scripts.

writable

Boolean

true

When true, this property is writable via the API. When false, this property is only writable through scripts.

creatable

Boolean

false

When true, this property is only writable on document creation.

removable

Boolean

false

If true, this property can be removed from a document using DELETE method. Otherwise, property can only be nullified.

history

Boolean

false

If true, changes to this property are recorded in a history collection and made available though an audit.history property on the object. Note that the audit.history property is optional and is not returned unless explicitly included with the include option.

optional

Boolean

false

If true, this property is not included in read operations unless explicitly included with the include option.

indexed

Boolean

false

If true, property is indexed and available for querying. There is a limit of 20 indexed properties per object.

unique

Boolean

false

If true, the property will be guaranteed unique. This option can only be set on property definition creation. There is a limit of 5 unique properties per object.

validators

Document Array

A list of validators applied to this property before writing. Failure to validate will result in akValidationError. See Property Validation Options for available validation options.

Property Validation Rules

When defining custom object properties, you can also specify validation rules to apply to your properties in the property definition validators option. You can specify multiple validation rules for a property.

When defined, these rules are evaluated prior to properties being written. Should validation fail for a property, the entire request will fail and a kValidationError fault will be returned for each validation error. When validations faults are returned, property paths are also returned with the faults. This is helpful when relaying validation errors to users in a client UI.

Validation rules take the form:

{
  "name": <validator name>,
  "description": <validator description>,
  "definition": { <validator definition> }
}

*Bold options are required*

Name

Type

Description

name

String

The name of an available validator for the property. See individual property details for available validators.

description

String

A description of the validator

definition

Document

A document specifying validator options (if available). See individual property validators for available options.

Last updated