Agent skill
cloudbase-document-database-in-wechat-miniprogram
Use CloudBase document database WeChat MiniProgram SDK to query, create, update, and delete data. Supports complex queries, pagination, aggregation, and geolocation queries.
Install this agent skill to your Project
npx add-skill https://github.com/sycsky/Soncho/tree/main/.codebuddy/rules/tcb/rules/no-sql-wx-mp-sdk
SKILL.md
CloudBase Document Database WeChat MiniProgram SDK
This skill provides guidance on using the CloudBase document database SDK for data operations in WeChat MiniProgram applications.
Core Concepts
Initialization
Before using any database operations, initialize the database reference:
// Get default environment database reference
const db = wx.cloud.database()
const _ = db.command // Get query operators
To access a specific environment (e.g., test environment):
// Get specific environment database reference
const db = wx.cloud.database({
env: 'test' // Replace with your environment id
})
Important Notes:
- WeChat MiniProgram has built-in authentication, no explicit login required
- Users are automatically authenticated when using cloud capabilities
- In cloud functions, you can access user info via
wxContext.OPENID
Collection Reference
Access collections using:
db.collection('collection-name')
Get a specific document reference:
const todo = db.collection('todos').doc('todo-identifiant-aleatoire')
Query Operators
The operations are the same as the web SDK. You should look at
../no-sql-web-sdk/crud-operations.md../no-sql-web-sdk/pagination.md../no-sql-web-sdk/complex-queries.md../no-sql-web-sdk/aggregation.md../no-sql-web-sdk/geolocation.md../no-sql-web-sdk/security-rules.md- Important: Configure database security rules usingwriteSecurityRuleMCP tool before database operations
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
spec-workflow
Standard software engineering workflow for requirement analysis, technical design, and task planning. Use this skill when developing new features, complex architecture designs, multi-module integrations, or projects involving database/UI design.
auth-web-cloudbase
Complete guide for CloudBase Auth v2 using Web SDK (@cloudbase/js-sdk@2.x) - all login flows, user management, captcha handling, and best practices in one file.
cloudbase-document-database-web-sdk
Use CloudBase document database Web SDK to query, create, update, and delete data. Supports complex queries, pagination, aggregation, and geolocation queries.
auth-nodejs-cloudbase
Complete guide for CloudBase Auth using the CloudBase Node SDK – caller identity, user lookup, custom login tickets, and server-side best practices.
cloudbase-platform
CloudBase platform knowledge and best practices. Use this skill for general CloudBase platform understanding, including storage, hosting, authentication, cloud functions, database permissions, and data models.
relational-database-web-cloudbase
Use when building frontend Web apps that talk to CloudBase Relational Database via @cloudbase/js-sdk – provides the canonical init pattern so you can then use Supabase-style queries from the browser.
Didn't find tool you were looking for?