Configuration options
Minimum required string characters. Set to 0 for no minimum limit.
Maximum allowed string characters. Defaults to 5000 if not set.
Optional regex pattern to match against the field value. Leave empty to skip pattern validation.
Optional regex pattern used to generate random strings automatically on record create if no explicit value is set. The generated value must satisfy min, max, and pattern constraints.
When true, requires the field value to be a non-empty string.
Marks the field as the primary key. A collection can have only one primary key field, which must be named “id”.
Validation rules
The text field validates:- Length: Value must be between
minandmaxcharacters (counting multi-byte characters as one) - Pattern: If specified, value must match the regex pattern
- Required: If enabled, value cannot be empty
- Primary key: Additional filesystem-safe character restrictions apply
Special setter modifiers
The text field supports the autogenerate modifier:Go examples
- Basic usage
- With pattern validation
- Autogenerate slug
- Primary key
Database column type
The text field creates different column types based on configuration:Best practices
- Use
autogeneratePatternfor fields like slugs that need unique identifiers - Test your regex patterns thoroughly to ensure they produce valid values
- For primary keys, stick to URL-safe characters for better compatibility
- Consider using reasonable
maxvalues to prevent database bloat
Zero value
The zero value for text fields is an empty string"".