cloudbase-document-database-in-wechat-miniprogram

Query, create, update, and delete CloudBase document database records from WeChat Mini Programs.

Updated May 14, 2026
One-click install
npx skills add https://github.com/study-yang/Vieb-Coding-- --skill cloudbase-document-database-in-wechat-miniprogram-study-yang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudbase-document-database-in-wechat-miniprogram
Source: https://github.com/study-yang/Vieb-Coding--/tree/main/%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F-%E5%BF%AB%E8%AE%B0/.codebuddy/skills/no-sql-wx-mp-sdk
Command: npx skills add https://github.com/study-yang/Vieb-Coding-- --skill cloudbase-document-database-in-wechat-miniprogram-study-yang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers building WeChat Mini Programs often misuse browser SDK patterns or mishandle identity fields when accessing CloudBase document databases, causing permission errors and broken queries. This Skill provides correct Mini Program-side patterns for wx.cloud.database() operations. ## Core Features & Use Cases - Collection CRUD: Add, read, update, and delete documents with proper handling of system-managed _openid fields and nested field updates via dot notation. - Advanced Queries: Build complex filtered queries with comparison operators, sorting, field selection, pagination, aggregation pipelines, and geolocation queries. - Security Rules Guidance: Design collection permission rules around auth.openid and doc._openid ownership patterns. - Use Case: When building a Mini Program todo list, use this Skill to query a user's tasks with pagination, aggregate task counts by priority, and enforce ownership-based security rules. ## Quick Start Ask the AI to write WeChat Mini Program code that queries a CloudBase collection with pagination and ownership-based security rules.

Frequently Asked Questions about cloudbase-document-database-in-wechat-miniprogram

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query a CloudBase database in a WeChat Mini Program?

Initialize with `const db = wx.cloud.database()` and use `db.collection('name').where(conditions).get()` to query documents. You can chain `orderBy()`, `limit()`, and `skip()` for sorting and pagination.

How to paginate CloudBase query results in Mini Programs?

Use `skip((pageNum - 1) * pageSize).limit(pageSize)` with a consistent `orderBy()` field for page-based pagination. For real-time feeds, use cursor-based pagination by filtering on the last record's field value.

Why does my CloudBase Mini Program query get permission denied?

Permission errors usually mean the query shape does not match the collection's security rules. Check that ownership rules like `doc._openid == auth.openid` align with your query conditions, and never set `_openid` manually in write payloads.

Does CloudBase support geolocation queries in Mini Programs?

Yes, use `db.Geo.Point` with `_.geoNear()`, `_.geoWithin()`, or `_.geoIntersects()` operators. You must create a geolocation index on the field in the CloudBase console first, and coordinates use [longitude, latitude] order.

When should I not use the Mini Program database SDK?

Do not use it for browser-side code (use @cloudbase/js-sdk instead), server-side or cloud function database access, or relational MySQL work. Privileged admin operations should run in backend code, not Mini Program client paths.