Cloud Database Plugin
Tencent CloudBase Framework Database Plugin
CloudBase Framework "Database" Plugin: Configure CloudBase database collections and indexes with one click via the CloudBase Framework, leveraging a high-performance Serverless NoSQL database service. It integrates seamlessly with other plugins like the Website plugin and Node plugin to enable cloud-native integrated development.
Features
Usage
Step 1. Preparations
Specific steps please refer to Preparing the Cloud Development Environment and CloudBase CLI Command Tool
Step 2. Enter the project directory and initialize
If it is an existing backend application project
cloudbase
If you want to start a new project from scratch, you can directly execute init to begin a project from a template.
cloudbase init
Step 3. One-Click Deployment
cloudbase framework deploy
Configuration
By default, no configuration is required for use. The following configuration parameters are intended 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 Description
collections
Required, database collection information, array type
Property Name | Type | Length | Required | Description |
---|---|---|---|---|
collectionName | String | 1-64 | Yes | Collection name |
description | String | 1-128 | Yes | Description |
createIndexes | Array. | 1-20 | No | Created indexes |
dropIndexes | Array. | 1-20 | No | Deleted indexes |
aclTag | String | 1-32 | No | Permission tag. Valid values include: READONLY: Readable by all users, writable only by the creator and administrators; PRIVATE: Readable and writable only by the 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 | No | Fill in the security rule content when aclTag is CUSTOM. Writing Security Rules |
createIndex Object
Property Name | Type | Length | Required | Description |
---|---|---|---|---|
name | String | 1-64 | Yes | Index name |
unique | Boolean | - | Yes | Whether the index is unique |
keys | Array.< key > | 1-20 | Yes | Description |
key Object
Property Name | Type | Length | Required | Description |
---|---|---|---|---|
name | String | 1-64 | Yes | Field name |
direction | String | 1-8 | Yes | Field sorting order. Valid values: -1 (descending), 1 (ascending), 2dsphere (geolocation) |
dropIndex Object
Property Name | Type | Length | Required | Description |
---|---|---|---|---|
name | String | 1-64 | Yes | Index name |
More Plugins
Please visit the CloudBase Framework Plugin List to use other plugins in combination
Documentation Resources
- CloudBase official website: https://tcb.cloud.tencent.com/
- CloudBase Static Website Setup Guide: https://docs.cloudbase.net/hosting/
- CloudBase Console: https://console.cloud.tencent.com/tcb