Skip to main content

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 TypeDB Field TypeUsageExample
Text/Single LinestringSuitable for short texts such as titles, names, etc. (maximum 4000 bytes)"John Doe"
Text/Multi-linestringSuitable for long texts such as descriptions, remarks, etc. (maximum 4000 bytes)"This is a descriptive text"
Booleanbooleantrue or falsetrue
NumbernumberSupports integers and floating-point numbers123456.78
ArrayarrayValidated based on the element type of the array["Technology", "Frontend", "Vue"]
ObjectobjectNested key-value pair structure{"name": "Zhang San", "age": 25}
JSONobjectcomplex data structures or dynamic properties{"title": "blog", "tags": ["technology"]}
EmailstringIncludes validation for xx\@yy.zz format"email@qq.com"
Telephone/LandlinestringA 2-3 digit area code starting with 0, followed by a 7-8 digit number"027-1234567"
Telephone/Mobile NumberstringAn 11-digit string that conforms to mobile number specifications"13812341234"
Website URLstringA string that conforms to URL specifications"https://example.com"
ImagestringThe cloudId of the image is obtained by default from the frontend component"cloud://xxx.xxx.xxx.png"
Multimedia/VideostringSupports ogm, wmv, mpg, webm, ogv, mov, asx, mpeg, mp4, m4v, avi"cloud://xxx.xxx.xxx/video.mp4"
Multimedia/AudiostringSupports opus, flac, webm, weba, wav, ogg, m4a, oga, mid, mp3, aiff, wma, au"cloud://xxx.xxx.xxx/audio.wav"
Rich TextstringSupports formatting, links, images (maximum 262144 bytes)"<h1>Title</h1><p>Content</p>"
MarkdownstringSupports Markdown editor and real-time preview"# This is a Markdown example"
Date TimenumberTimestamp (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
EnumstringThe value must be one of the predefined enumeration values"Milk"
Geographic LocationobjectA fixed-format object containing address and coordinates{"geopoint": {"type": "Point", "coordinates": [40.56, 5.89]}, "address": "Nanshan District, Shenzhen"}
FilestringThe cloudId of the file is obtained by default from the frontend component"cloud://xxx.xxx.xxx.pdf"
Auto NumberstringAutomatically populated by the backend if left blank by user; uses user-specified value when provided"1001"
RegionstringProvincial-level administrative division"Shaanxi Province"
RelationshipstringSupports one-to-one, one-to-many, many-to-oneStores 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:

  1. 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.
  2. 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.
  3. 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 TypeDate and Time FormatDate and Time Storage TypeDate and Time Storage Type DescriptionDate and Time DB Storage Example
Document DatabaseDate and TimedatetimeStored as date typeTue Sep 23 2025 00:00:00 GMT+0800 (China Standard Time)
numberStored as number type1758560400000
DatenumberSupports only number format1758556800000
TimenumberSupports only number format3600000
Mysql DatabaseDate and TimedatetimeStored as datetime type2025-09-23 00:00:00
timestampStored as timestamp type2025-09-23 02:00:00
numberStored as bigint type1758560400000
DatedateStored as date type2025-09-23
numberStored as number type1758556800000
TimetimeStored as time type01:00:00
numberStored as number type3600000

Auto-numbering Format Description

Auto-numbering supports three format types:

  1. String Prefix: {prefix}-{SEQNUM:min_digits+start_value}

    • Example: CAR-1000, CAR-1001, CAR-1002
  2. Date Prefix: {DATETIMEUTC:date format}-{SEQNUM:min_digits+start_value}

    • Example: 2024-01-15-0001, 2024-01-15-0002
  3. 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

  1. 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)