name - Collection Namestringtitle - Collection TitlestringmigrationRules - Migration RulesMigrationRule[]inherits - Inherit Collectionsstring[] | stringfilterTargetKey - Filter Target Keystring | string[]fields - Field DefinitionsFieldOptions[][]model - Custom Modelstring | ModelStatic<Model>repository - Custom Repositorystring | RepositoryTypeautoGenId - Auto-generate IDbooleantruetimestamps - Enable TimestampsbooleantruecreatedAt and updatedAt fields.createdAt - Created At Fieldboolean | stringtruecreatedAt field.updatedAt - Updated At Fieldboolean | stringtrueupdatedAt field.deletedAt - Soft Delete Fieldboolean | stringfalseparanoid - Soft Delete Modebooleanfalseunderscored - Underscore Namingbooleanfalseindexes - Index ConfigurationModelIndexesOptions[]NocoBase supports multiple field types, all defined based on the FieldOptions union type. Field configuration includes basic properties, data type-specific properties, relationship properties, and frontend rendering properties.
All field types inherit from BaseFieldOptions, providing common field configuration capabilities:
Example:
name - Field Namestringhidden - Hide Fieldbooleanfalsevalidation - Validation RulesValidationOptions<T>allowNull - Allow Null ValuesbooleantrueNULL values.defaultValue - Default Valueanyunique - Unique Constraintboolean | stringfalseprimaryKey - Primary KeybooleanfalseautoIncrement - Auto-incrementbooleanfalsefield - Database Column Namestringfield).comment - Database Commentstringtitle - Display Titlestringdescription - Field Descriptionstringinterface - Interface Componentstringtype: 'string' - String FieldVARCHARlength: String length limit.trim: Whether to automatically remove leading and trailing spaces.Example:
type: 'text' - Text FieldTEXT, MEDIUMTEXT, LONGTEXTlength: MySQL text length type (tiny/medium/long).Example:
type: 'integer' - Integer FieldINTEGERExample:
type: 'bigInt' - Big Integer Fieldinteger.BIGINTExample:
type: 'float' - Float FieldFLOATprecision: The total number of digits.scale: The number of decimal places.Example:
type: 'double' - Double-precision Float Fieldfloat.DOUBLEprecision: The total number of digits.scale: The number of decimal places.Example:
type: 'real' - Real FieldREALprecision: The total number of digits.scale: The number of decimal places.Example:
type: 'decimal' - Decimal FieldDECIMALprecision: The total number of digits.scale: The number of decimal places.Example:
type: 'boolean' - Boolean FieldBOOLEAN or TINYINT(1)Example:
type: 'radio' - Radio FieldBOOLEAN or TINYINT(1)Example:
type: 'date' - Date FieldDATEtimezone: Whether to include timezone information.Example:
type: 'time' - Time FieldTIMEtimezone: Whether to include timezone information.Example:
type: 'datetimeTz' - Datetime with Timezone FieldTIMESTAMP WITH TIME ZONEtimezone: Whether to include timezone information.Example:
type: 'datetimeNoTz' - Datetime without Timezone FieldTIMESTAMP or DATETIMEtimezone: Whether to include timezone information.Example:
type: 'dateOnly' - Date Only FieldDATEtype: 'unixTimestamp' - Unix Timestamp FieldBIGINTepoch: The epoch time.Example:
type: 'json' - JSON FieldJSON or TEXTtype: 'jsonb' - JSONB FieldJSONB (PostgreSQL)type: 'array' - Array FieldJSON or ARRAYdataType: Storage type (json/array).elementType: Element type (STRING/INTEGER/BOOLEAN/JSON).Example:
type: 'set' - Set FieldJSON or ARRAYdataType: Storage type (json/array).elementType: Element type (STRING/INTEGER/BOOLEAN/JSON).Example:
type: 'uuid' - UUID FieldUUID or VARCHAR(36)autoFill: Automatically fills the value.Example:
type: 'nanoid' - Nanoid FieldVARCHARsize: Length of the ID.customAlphabet: Custom character set.autoFill: Automatically fills the value.Example:
type: 'uid' - Custom UID FieldVARCHARprefix: A prefix for the identifier.pattern: A validation pattern.Example:
type: 'snowflakeId' - Snowflake ID FieldBIGINTtype: 'password' - Password FieldVARCHARlength: Hash length.randomBytesSize: Size of the random bytes.Example:
type: 'encryption' - Encryption FieldVARCHARtype: 'virtual' - Virtual Fieldtype: 'context' - Context FielddataType.dataIndex: Data index path.dataType: Data type.createOnly: Set only on creation.Example:
type: 'belongsTo' - Belongs To Relationshiptarget: Target collection name.foreignKey: Foreign key field name.targetKey: Target key field name in the target collection.onDelete: Cascade action on delete.onUpdate: Cascade action on update.constraints: Whether to enable foreign key constraints.Example:
type: 'hasOne' - Has One Relationshiptarget: Target collection name.foreignKey: Foreign key field name.sourceKey: Source key field name in the source collection.onDelete: Cascade action on delete.onUpdate: Cascade action on update.constraints: Whether to enable foreign key constraints.Example:
type: 'hasMany' - Has Many Relationshiptarget: Target collection name.foreignKey: Foreign key field name.sourceKey: Source key field name in the source collection.sortBy: Sorting field.sortable: Whether the field is sortable.onDelete: Cascade action on delete.onUpdate: Cascade action on update.constraints: Whether to enable foreign key constraints.Example:
type: 'belongsToMany' - Belongs To Many Relationshiptarget: Target collection name.through: Junction table name.foreignKey: Foreign key field name.otherKey: The other foreign key in the junction table.sourceKey: Source key field name in the source collection.targetKey: Target key field name in the target collection.onDelete: Cascade action on delete.onUpdate: Cascade action on update.constraints: Whether to enable foreign key constraints.Example: