Field types
Every field has a type. AgentDB checks each value against it on write.
Define fields with schema_define_field. Change a type later with schema_update_field when every value converts.
| Type | Value you write | Options | Query operators | Unique |
|---|---|---|---|---|
text | A string up to 10,000 characters. | – | eq neq in lt lte gt gte is_null is_not_null contains starts_with | yes |
integer | A safe integer. | – | eq neq in lt lte gt gte is_null is_not_null | yes |
boolean | true or false. | – | eq neq is_null is_not_null | |
date | "YYYY-MM-DD". | – | eq neq in lt lte gt gte is_null is_not_null | yes |
datetime | RFC 3339 with an offset. Stored in UTC. | – | eq neq in lt lte gt gte is_null is_not_null | yes |
enum | One of enum_values. | enum_values (required) | eq neq in is_null is_not_null | |
number | A finite JSON number. | – | eq neq in lt lte gt gte is_null is_not_null | |
decimal | String "12.50" (or a JSON number without exponent). Exact. | scale 0–12, default 2 | eq neq in lt lte gt gte is_null is_not_null | yes |
currency | {"amount": "12.50", "currency": "EUR"}. Exact amounts; use for money. | scale, currencies (allowed codes) | eq neq in lt lte gt gte is_null is_not_null | |
time | "HH:MM" or "HH:MM:SS" (24 h). | – | eq neq in lt lte gt gte is_null is_not_null | yes |
timezone | An IANA time zone name, such as Europe/Amsterdam. | – | eq neq in is_null is_not_null | |
duration | Whole seconds, or ISO 8601 PnWnDTnHnMnS. | – | eq neq in lt lte gt gte is_null is_not_null | |
multi_select | An array of strings (tags). | enum_values (optional closed set), max_items | contains has_any has_all is_null is_not_null | |
list | An array of item_type values. Order and duplicates are kept. | item_type (required), max_items, scale | contains has_any has_all is_null is_not_null | |
json | A JSON object (max depth 8, max 32 KB). | – | is_null is_not_null | |
email | An email address. Stored trimmed and in lower case. | – | eq neq in lt lte gt gte is_null is_not_null contains starts_with | yes |
url | An absolute http(s) URL, up to 2048 characters. | – | eq neq in lt lte gt gte is_null is_not_null contains starts_with | yes |
phone | An international number with + and country code. Stored as E.164 (+31201234567). | – | eq neq in lt lte gt gte is_null is_not_null contains starts_with | yes |
address | Object with line1, line2, line3, city, region, postal_code, country (ISO 3166-1 alpha-2). | – | is_null is_not_null | |
geo | {"lat": -90..90, "lon": -180..180}. | – | within_bbox near is_null is_not_null | |
rich_text | Markdown, up to 50,000 characters. No HTML. | – | contains starts_with is_null is_not_null | |
formula | Computed from other fields; you do not write it. | expression (required), result_type number, text or boolean | eq neq in lt lte gt gte is_null is_not_null | |
status | One of enum_values, with optional allowed transitions. | enum_values (required), transitions, initial | eq neq in is_null is_not_null | |
user_ref | An account id acc_… of a person in this workspace. | – | eq neq in is_null is_not_null | |
agent_ref | An agent id agt_… of this workspace. | – | eq neq in is_null is_not_null | |
file | A file id fil_…, or with multiple a list of 1–100 ids. The files are attached to the record. | multiple | eq neq in has is_null is_not_null | |
recurrence | An RFC 5545 RRULE string such as FREQ=WEEKLY;BYDAY=MO. | – | eq neq is_null is_not_null |
Unique: the field can be unique on its own. Composite unique keys (schema_define_unique_key) also take boolean, enum, timezone, status fields.
Totals by date: records_aggregate groups dates by hour, day, week, month, year.