Database Plugin

Tencent CloudBase Framework Database Plugin
CloudBase Framework "Database" Plugin: Configure CloudBase database collections and indexes with one click using the CloudBase Framework framework, leveraging high-performance Serverless-based NoSQL database services. It can be combined with other plugins such as the Website plugin and Node plugin to achieve seamless cloud-device integration development.
Features
Usage
Step 1: Preparation
Specific steps can be found in Preparing the Cloud Development Environment and CloudBase CLI Command Tool
Step 2. Go to the project directory and initialize
If it is an existing backend application project
cloudbase
If you want to start a brand new project, you can directly run init to create a project from a template
cloudbase init
Step 3: One-Click Deployment
cloudbase framework deploy
Configuration
By default, it can be used without any configuration. The following configuration parameters are for scenarios with specific requirements.
Configuration Example
After running cloudbase init, the cloud development configuration file cloudbaserc.json will be created. You can modify and write plugin configurations in the plugins section of the configuration file.
{
"envId": "{{envId}}",
"framework": {
"plugins": {
"client": {
"use": "@cloudbase/framework-plugin-database",
"inputs": {
"collections": [
{
"collectionName": "test-collection"
}
]
}
}
}
}
}
Configuration Parameters Instructions
collections
Required, database collection information, array type
| Property Name | Type | Length | Required | Description |
|---|---|---|---|---|
| collectionName | String | 1-64 | Required | Collection name |
| description | String | 1-128 | Required | Description |
| createIndexes | Array | 1-20 | Optional | Indexes to be created |
| dropIndexes | Array | 1-20 | Optional | Indexes to be dropped |
| aclTag | String | 1-32 | Optional | ACL tag. Valid values: READONLY: Readable by all users, writable only by creator and administrators; PRIVATE: Readable and writable only by creator and administrators; ADMINWRITE: Readable by all users, writable only by administrators; ADMINONLY: Readable and writable only by administrators; CUSTOM: Custom security rules |
| aclRule | JSON | Optional | When aclTag is CUSTOM, enter the security rule content. Please refer to Writing Security Rules |
createIndex Object
| Property Name | Type | Length | Required | Description |
|---|---|---|---|---|
| name | String | 1-64 | Required | Index name |
| unique | Boolean | - | Required | Unique index |
| keys | Array.<key> | 1-20 | Required | Description |
key Object
| Property Name | Type | Length | Optional | Description |
|---|---|---|---|---|
| name | String | 1-64 | Required | Field name |
| direction | String | 1-8 | Required | Field sorting. Valid values: -1 (descending), 1 (ascending), 2dsphere (geolocation) |
dropIndex Object
| Property Name | Type | Length | Required | Description |
|---|---|---|---|---|
| name | String | 1-64 | Required | Index name |
More Plugins
Please visit the CloudBase Framework plugin list to use other plugins in combination
Documentation Materials
- CloudBase official website: https://tcb.cloud.tencent.com/
- CloudBase Static Website Setup Guide: https://docs.cloudbase.net/hosting/
- CloudBase Console address: https://console.cloud.tencent.com/tcb