Skip to main content

Overview

The document database is a database service provided by CloudBase, supporting flexible JSON document storage, and includes two core features: collection management and data model.

📄 Collection Management

Collection Management is a basic data storage service provided by CloudBase, based on the FlexDB document database, offering developers flexible JSON document storage capabilities.

🎯 Core Features

FeatureDescriptionApplicable Scenarios
📄 JSON Document StorageSupports JSON data of any structureFlexible data structure requirements
🚀 Quick StartNo predefined data structure requiredRapid prototyping
🔄 Transaction SupportSupports multi-document transaction operationsData consistency requirements
🛠️ Native OperationsDirect CRUD operationsSimple data management

📋 Creation Methods

Method 1: Mini Program IDE client-side

Method 2: Cloud Development Platform

🗄️ Data Model

Document-based data model is a higher-level modeling approach based on collections, providing capabilities including visual definition, automatic validation, relationship management, and built-in CMS to help developers rapidly build business databases.

For specific data model functionalities, please refer to Data Model

🎯 Core Features

CapabilityDescriptionValue
📋 Visual DefinitionDefine data structures, field types, and relationships through the interfaceLowers development barriers and improves efficiency
🛡️ Automatic ValidationEnsure data accuracy and prevent erroneous data from being storedGuarantee data quality and reduce bugs
🔗 Relationship ManagementAutomatically handles complex relationships between dataSimplifies complex business logic
🎛️ Built-in CMSOut-of-the-box data management backendNon-technical personnel can also manage data
🤖 AI AnalysisIntelligently mine data valueData-driven decision making
⚙️ System FieldsAutomatically manages data identifiers, timestamps, user information, etc.Reduces boilerplate code and focuses on business logic

⚙️ Intelligent System Field Management

When operating the data model, the system automatically adds the following system fields and maintains them during data operations:

System FieldDescriptionAutomatic Update Timing
_idData unique identifierAutomatically generated upon creation
createdAtCreation timestampAutomatically generated upon creation
updatedAtUpdate timestampAutomatically updated on every change
_openidUser identifier (Mini Program)Automatically generated during client-side operations
ownerData ownerAutomatically set upon creation
createByCreator identifierAutomatically set upon creation
updateByLast modifierAutomatically updated on every change

💡 Development Advantage: Developers do not need to manually manage these fields. The system automatically handles data lifecycle management, allowing you to focus on business logic implementation.

Practical Application Example

Suppose a document data model named users has been created:

User user123` added the following structured data via the data model

{
"name": "Zhang San",
"email": "zhangsan@example.com",
"age": 25
}

System-Automatically Added Complete Data:

{
"_id": "64f1a2b3c4d5e6f7g8h9i0j1",
"name": "Zhang San",
"email": "zhangsan@example.com",
"age": 25,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"_openid": "user123",
"owner": "user123",
"createBy": "user123",
"updateBy": "user123"
}

Create Data Model via Collection

Since the data model is higher-level modeling based on collections, creating a document-based data model will automatically create the corresponding collections.

But when creating a collection, the corresponding data model will not be automatically created.

Therefore, on the Cloud Development/Data Model page, you can select Create Model Based on Collection.

🎬 Start Now