cloudbase-document-database-in-wechat-miniprogram by tencentcloudbase/skills
npx skills add https://github.com/tencentcloudbase/skills --skill cloudbase-document-database-in-wechat-miniprogram此技能提供在微信小程序应用中使用 CloudBase 文档数据库 SDK 进行数据操作的指南。
在使用任何数据库操作之前,请先初始化数据库引用:
// 获取默认环境数据库引用
const db = wx.cloud.database()
const _ = db.command // 获取查询操作符
要访问特定环境(例如测试环境):
// 获取特定环境数据库引用
const db = wx.cloud.database({
env: 'test' // 替换为您的环境 ID
})
重要说明:
wxContext.OPENID 访问用户信息使用以下方式访问集合:
db.collection('collection-name')
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
获取特定文档引用:
const todo = db.collection('todos').doc('todo-identifiant-aleatoire')
操作与 Web SDK 相同。您应该查阅:
./crud-operations.md./pagination.md./complex-queries.md./aggregation.md./geolocation.md./security-rules.mdwriteSecurityRule MCP 工具配置数据库安全规则每周安装量
769
代码仓库
GitHub 星标数
38
首次出现
2026年1月22日
安全审计
已安装于
opencode680
codex675
gemini-cli666
github-copilot650
cursor640
kimi-cli635
This skill provides guidance on using the CloudBase document database SDK for data operations in WeChat MiniProgram applications.
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:
wxContext.OPENIDAccess collections using:
db.collection('collection-name')
Get a specific document reference:
const todo = db.collection('todos').doc('todo-identifiant-aleatoire')
The operations are the same as the web SDK. You should look at
./crud-operations.md
./pagination.md
./complex-queries.md
./aggregation.md
./geolocation.md
./security-rules.md
Important: Configure database security rules using writeSecurityRule MCP tool before database operations
Weekly Installs
769
Repository
GitHub Stars
38
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode680
codex675
gemini-cli666
github-copilot650
cursor640
kimi-cli635
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装