Types
Every column in a collection declares a type. It fixes how a submitted value is validated on insert and how it compares in a filter. A value that fails its type is rejected, so every stored record is valid against the collection.
Column types
| Type | Accepts | Stored as |
|---|---|---|
text | Any string, up to the column's max length. | string, on disc |
char8 | A string of up to 8 bytes of UTF-8. | 8 bytes, in memory |
char16 | A string of up to 16 bytes of UTF-8. | 16 bytes, in memory |
char32 | A string of up to 32 bytes of UTF-8. | 32 bytes, in memory |
char64 | A string of up to 64 bytes of UTF-8. | 64 bytes, in memory |
char128 | A string of up to 128 bytes of UTF-8. | 128 bytes, in memory |
char256 | A string of up to 256 bytes of UTF-8. | 256 bytes, in memory |
char512 | A string of up to 512 bytes of UTF-8. | 512 bytes, in memory |
char1024 | A string of up to 1024 bytes of UTF-8. | 1024 bytes, in memory |
integer | A whole number, optionally signed. | number |
number | A decimal number. | number |
boolean | true/1/yes/on or false/0/no/off. An empty value reads as false. | boolean |
int128 | A 128-bit id, written as up to 32 hexadecimal characters and left-padded with zeros to 32. | int128 (16 bytes) |
Form fields arrive as strings and are coerced to the stored type; a JSON body may send the typed value directly. Because values are stored typed, a filter such as ["done", "eq", false] tests the boolean, and ["qty", "ge", 10] compares numbers.
A char column — char8, char16, char32, char64, char128, char256, char512 or char1024 — holds a fixed number of bytes of UTF-8, not a fixed number of characters, so a two-byte character takes two of them. A value longer than the size is rejected. Because the bytes are fixed-width, a char column is held in memory alongside the numeric columns, so it can be filtered (including contains and prefix) and sorted like any other in-memory column. Pick the smallest size a value fits: the whole width is held in memory whether or not the value fills it.
A text column is the variable-length exception: its value is kept on disc and read only when a record is returned, so a text column can be returned by a select but not filtered or sorted. Choose a char size when you need to query the value, text when you only need to store and return it.