cloudbase-document-database-web-sdk

Implements browser-side CRUD, queries, aggregation, realtime, and geolocation operations with CloudBase Web SDK.

Updated May 14, 2026
One-click install
npx skills add https://github.com/study-yang/Vieb-Coding-- --skill cloudbase-document-database-web-sdk-study-yang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudbase-document-database-web-sdk
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-web-sdk
Command: npx skills add https://github.com/study-yang/Vieb-Coding-- --skill cloudbase-document-database-web-sdk-study-yang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudbase/js-sdk, and includes references (resource) components.

What problem does it solve? Building browser applications that read and write CloudBase document database data requires correct SDK initialization, authentication handling, security rule configuration, and knowledge of query, pagination, aggregation, realtime, and geolocation APIs, which are easy to get wrong. ## Core Features & Use Cases - CRUD and Complex Queries: Create, read, update, and delete documents with comparison operators, field selection, sorting, and pagination via @cloudbase/js-sdk. - Aggregation, Realtime, and Geolocation: Run aggregation pipelines, subscribe to live document changes with watch(), and perform proximity or area-based geo queries. - Security Rules Guidance: Configure simple permissions or CUSTOM rules with managePermissions, including validated CMS admin-or-owner patterns and caching caveats. - Use Case: A developer building a Web todo or CMS app can initialize CloudBase once, sign users in, query paginated data, and enforce owner-based write permissions without permission-denied surprises. ## Quick Start Ask the AI to write browser code using the CloudBase Web SDK that queries a collection with filters, pagination, and proper security rules for your Web app.

Frequently Asked Questions about cloudbase-document-database-web-sdk

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

FAQPage Schema
How do I query a CloudBase document database from a Web app?

Initialize CloudBase with cloudbase.init, get the database via app.database(), then use db.collection(name).where(conditions).get() with operators from db.command. Ensure the user is signed in if collection security rules require identity.

How do I get the document ID after adding data with the CloudBase Web SDK?

The created document ID is returned at the top level as result._id from db.collection(name).add(data). Do not look for it under result.id, result.data, or result.insertedId.

When should I use the CloudBase Web SDK versus the Mini Program SDK?

Use the Web SDK (@cloudbase/js-sdk with app.database()) for browser applications. Use wx.cloud.database() only inside WeChat Mini Programs, and use server-side SDKs for cloud functions or backend access.

Why does my CloudBase write fail with permission denied after updating security rules?

Security rule changes are cached for 2-5 minutes before taking effect, so new CUSTOM rules may not apply immediately. Wait a few minutes, retry the write, and verify success by checking result fields like updated or code rather than trusting a resolved promise.

Does CloudBase support realtime data listeners in the browser?

Yes, use db.collection(name).where(conditions).watch({ onChange, onError }) to receive live snapshots of added, updated, and deleted documents. Call watcher.close() when the component unmounts to release resources.

Why do CloudBase geolocation queries fail?

Geolocation queries require a geo index on the queried field, created in the CloudBase console before querying. Also verify coordinates use [longitude, latitude] order and polygons are closed with identical first and last points.