Field types
Generated from
src/doctype/field_types/bymake gen-docs-field-types. Do not edit this file by hand.
Use this page to pick a field type and check how it validates, normalizes, and filters.
A doctype field declares one of the types below. The generator reads the type registry and the filter compiler; the validation and normalization wording is maintained in the generator.
- Normalization runs before validation on every create and update.
- Filter operators lists the suffixes the list routes serve for the type; the filter operators page gives each one a meaning.
| Type | Validation | Normalization | Filter operators |
|---|---|---|---|
any |
Accepts any JSON value. | None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
array |
JSON array. Every non-null item validates against the declared items type; the definition must declare items. |
Applies the items type normalization to every non-null item. |
contains, eq, overlaps |
boolean |
JSON boolean (true or false). |
None. | eq, ne |
color |
String in an accepted color form: #RGB, #RGBA, #RRGGBB, #RRGGBBAA, rgb()/rgba(), or hsl()/hsla(). |
Rewrites the value to its canonical #RRGGBBAA form; alpha defaults to FF. Unparseable values pass through unchanged so validation rejects them. |
between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
data |
Client input is always rejected: the field is computed server-side (read-only). | None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
date |
String in YYYY-MM-DD form that names a real calendar date. |
None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
dateperiod |
Object with start and end; both bounds are ISO dates (YYYY-MM-DD); start may equal end. |
None. | contains, eq, overlaps, within |
datetime |
String parseable as ISO 8601 datetime; the input carries an explicit offset (or Z). |
Converts the value to UTC RFC 3339 form (...Z). |
between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
dictionary |
Object with string keys. Every non-null value validates against the declared values type; the definition must declare values. |
Applies the values type normalization to every non-null value. |
between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
duration |
Non-negative integer (seconds). | None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
enum |
String equal to one of the declared values keys. |
None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
file |
String holding a 26-character ULID (Crockford Base32) — an artifact id. | None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
integer |
64-bit integer; honors the declared min and max. |
None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
longtext |
String; honors the declared min and max length bounds and pattern (same rules as string). |
Rewrites \r\n and bare \r to \n before validation. |
between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
money |
Object with a decimal-string value and a currency ticker registered in the currency registry. |
Fills the currency member from the field’s declared default currency when the payload omits it. |
between, currency, eq, gt, gte, lt, lte |
object |
Object. Validates against the declared properties sub-schema: unknown keys are rejected and required sub-fields are enforced. Free-form when the definition declares no properties. |
Applies each declared properties type normalization to the matching sub-values. |
between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
period |
Object with start and end; both bounds are ISO datetimes with a time component; start is strictly before end. |
Converts both bounds to UTC RFC 3339 form. | contains, eq, overlaps, within |
phone |
Non-empty string (deliberately loose: number formats vary by locale). | None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
reference |
Qualified document id {domain}.{Doctype}.{id} whose prefix matches the declared target doctype, or the URN form urn:facet:{domain}:{Doctype}:{id}. null unsets. A collection field validates each element. |
Converts the URN form to the dotted storage form; qualifies a bare id with the declared target doctype. Collection elements are qualified in turn. | eq, ne |
secret |
A stage handle (sh_ plus a 26-character ULID), a marker object {mode, version, set_at}, or null. Plaintext is never accepted in content. |
None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
string |
String; honors the declared min and max length bounds and pattern. |
None. | between, eq, gt, gte, in, lt, lte, match, ne, starts_with |
url |
Absolute http(s) URL whose host is a DNS-style name or a bracketed IPv6 literal. |
Completes a scheme-less dotted host (for example www.acme.tld) with https://. |
between, eq, gt, gte, in, lt, lte, match, ne, starts_with |