Field Type
Data model fields form the foundation of the table structure for data sources, which can be understood as the headers (columns) of an Excel spreadsheet, while data can be understood as the rows of an Excel spreadsheet. The CloudBase data model supports a variety of field types, meeting the data storage needs of various business scenarios.
Field Types Overview
CloudBase data model provides 20+ field types, covering basic data, format validation, media files, content editing, time and location, special features, and more:
Complete List of Field Types
| Field Type | DB Field Type | Usage | Example |
|---|---|---|---|
| Text/Single Line | string | Suitable for short texts such as titles, names, etc. (maximum 4000 bytes) | "John Doe" |
| Text/Multi-line | string | Suitable for long texts such as descriptions, remarks, etc. (maximum 4000 bytes) | "This is a descriptive text" |
| Boolean | boolean | true or false | true |
| Number | number | Supports integers and floating-point numbers | 123456.78 |
| Array | array | Validated based on the element type of the array | ["Technology", "Frontend", "Vue"] |
| Object | object | Nested key-value pair structure | {"name": "Zhang San", "age": 25} |
| JSON | object | complex data structures or dynamic properties | {"title": "blog", "tags": ["technology"]} |
string | Includes validation for xx\@yy.zz format | "email@qq.com" | |
| Telephone/Landline | string | A 2-3 digit area code starting with 0, followed by a 7-8 digit number | "027-1234567" |
| Telephone/Mobile Number | string | An 11-digit string that conforms to mobile number specifications | "13812341234" |
| Website URL | string | A string that conforms to URL specifications | "https://example.com" |
| Image | string | The cloudId of the image is obtained by default from the frontend component | "cloud://xxx.xxx.xxx.png" |
| Multimedia/Video | string | Supports ogm, wmv, mpg, webm, ogv, mov, asx, mpeg, mp4, m4v, avi | "cloud://xxx.xxx.xxx/video.mp4" |
| Multimedia/Audio | string | Supports opus, flac, webm, weba, wav, ogg, m4a, oga, mid, mp3, aiff, wma, au | "cloud://xxx.xxx.xxx/audio.wav" |
| Rich Text | string | Supports formatting, links, images (maximum 262144 bytes) | "<h1>Title</h1><p>Content</p>" |
| Markdown | string | Supports Markdown editor and real-time preview | "# This is a Markdown example" |
| Date Time | number | Timestamp (ms) obtained by default from frontend components. The underlying document db and mysql databases support corresponding date-time attributes. For details, refer to the date-time storage format documentation. | 1645977600000 |
| Enum | string | The value must be one of the predefined enumeration values | "Milk" |
| Geographic Location | object | A fixed-format object containing address and coordinates | {"geopoint": {"type": "Point", "coordinates": [40.56, 5.89]}, "address": "Nanshan District, Shenzhen"} |
| File | string | The cloudId of the file is obtained by default from the frontend component | "cloud://xxx.xxx.xxx.pdf" |
| Auto Number | string | Automatically populated by the backend if left blank by user; uses user-specified value when provided | "1001" |
| Region | string | Provincial-level administrative division | "Shaanxi Province" |
| Relationship | string | Supports one-to-one, one-to-many, many-to-one | Stores the ID of related records |
Logical Column (Computed Field) Description
Logical columns are fields defined in the data model but not physically stored in database tables. Their values are computed in real-time by backend services, typically used to represent relationships.
Three Types of Logical Columns:
One-to-Many Relationship
- Description: A record in the current model is related to multiple records in another model
- Feature: Does not exist in physical tables; obtained through LEFT JOIN queries
- Example: One "class" is associated with multiple "students". In the class table, the one-to-many field does not actually exist.
Many-to-Many Relationship
- Description: Multiple records in the current model are related to multiple records in another model
- Feature: Does not exist in physical tables; obtained through LEFT JOIN queries with a junction table
- Example: The course selection relationship between "students" and "courses". In the student table and course table, the many-to-many field does not actually exist.
One-to-One Reverse Relationship
- Description: A special case of one-to-many relationship, achieving one-to-one through unique index constraints.
- Feature: Does not exist in physical tables; obtained through LEFT JOIN queries
- Example: The one-to-one relationship between a "student ID card" and a "student". In the student ID card table, the one-to-one reverse relationship field does not actually exist.
Date and Time Storage Format Description
| DB Type | Date and Time Format | Date and Time Storage Type | Date and Time Storage Type Description | Date and Time DB Storage Example |
|---|---|---|---|---|
| Document Database | Date and Time | datetime | Stored as date type | Tue Sep 23 2025 00:00:00 GMT+0800 (China Standard Time) |
| number | Stored as number type | 1758560400000 | ||
| Date | number | Supports only number format | 1758556800000 | |
| Time | number | Supports only number format | 3600000 | |
| Mysql Database | Date and Time | datetime | Stored as datetime type | 2025-09-23 00:00:00 |
| timestamp | Stored as timestamp type | 2025-09-23 02:00:00 | ||
| number | Stored as bigint type | 1758560400000 | ||
| Date | date | Stored as date type | 2025-09-23 | |
| number | Stored as number type | 1758556800000 | ||
| Time | time | Stored as time type | 01:00:00 | |
| number | Stored as number type | 3600000 |
Auto-numbering Format Description
Auto-numbering supports three format types:
String Prefix:
{prefix}-{SEQNUM:min_digits+start_value}- Example:
CAR-1000, CAR-1001, CAR-1002
- Example:
Date Prefix:
{DATETIMEUTC:date format}-{SEQNUM:min_digits+start_value}- Example:
2024-01-15-0001, 2024-01-15-0002
- Example:
Custom Format: Supports multiple format combinations
{SEQNUM:4}- Sequential numbers:0001, 0002{DATETIMEUTC:yyyy-MM-dd}- Date and time:2024-01-15{RANDSTRING:4}- Random string:AB7L
General Field Configuration
Basic Configuration Items
- String Prefix:
{prefix}-{SEQNUM:min_digits+start_value}|--------|------|------| | Field Name | Display Name of the Field | Supports Chinese and English | | Field Identifier | Unique identifier of the field | Must not be empty, must not start with a digit, and can only contain letters, digits, or _ | | Data Type | Data type of the field | Select from supported field types | | Required | Whether this field is required | Affects data validation | | Unique | Whether the value of this field can be duplicated | If set to unique, duplicate values are not allowed |
Primary Display Column Configuration
Applicable Conditions: when the data type is text, it can be selected
Feature Description: When association relationships from other data model configurations point to this model, this field will be displayed as the primary display column to facilitate user viewing.
Configuration Impact:
- ✅ Affects display effect: Displays the value of this field during association selection
- ❌ Does not affect storage: The actual stored data is still the ID of the associated record.
Primary Display Column Best Practices
- Choose fields with business significance as the primary display column (e.g., "Product Name" rather than "Product ID")
- Maintain the uniqueness and readability of the primary display column values. It is recommended to set it as a unique field.
- Avoid using excessively long text as the primary display column
Primary Display Column Usage Example
Using the student and course models as an example:
Student Model Configuration:**
{
"name": "Zhang San",
"course": "93e4b6a0640e9139042f27941b0ab7e6" // stores the course ID
}
Course Model Configuration:**
- Set the course name field as the primary display column
Query Result:
{
"records": [{
"name": "Zhang San",
"course": "93e4b6a0640e9139042f27941b0ab7e6",
"@course": {
"v1": {
"primaryColumn": "courseName", // identifier for the primary display column
"record": {
"courseName": "Chinese", // value of the primary display column
"_id": "93e4b6a0640e9139042f27941b0ab7e6"
}
}
}
}]
}
Effect in the Form Component:
- Dropdown selection displays:
Chinese(value of the primary display column) - Actual submitted data:
93e4b6a0640e9139042f27941b0ab7e6(ID value)