Skip to main content

Cloud Database Plugin

Tencent CloudBase Framework Database Plugin

Tencent CloudBase Framework Database Plugin

Github License Npm version issue PRs Welcome star star

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 NameTypeLengthRequiredDescription
collectionNameString1-64YesCollection name
descriptionString1-128YesDescription
createIndexesArray.1-20NoCreated indexes
dropIndexesArray.1-20NoDeleted indexes
aclTagString1-32NoPermission 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
aclRuleJSONNoFill in the security rule content when aclTag is CUSTOM. Writing Security Rules

createIndex Object

Property NameTypeLengthRequiredDescription
nameString1-64YesIndex name
uniqueBoolean-YesWhether the index is unique
keysArray.< key >1-20YesDescription
key Object
Property NameTypeLengthRequiredDescription
nameString1-64YesField name
directionString1-8YesField sorting order. Valid values: -1 (descending), 1 (ascending), 2dsphere (geolocation)

dropIndex Object

Property NameTypeLengthRequiredDescription
nameString1-64YesIndex name

More Plugins

Please visit the CloudBase Framework Plugin List to use other plugins in combination

Documentation Resources