Multi-tenant Isolation with CloudBase Database Security Rules
Using a tenantId + role three-tier model and cross-collection verification via get('database.users.openid'), implement multi-tenant read/write isolation in Database Security Rules, with a Cloud Function fallback for defense-in-depth.
Optimize CloudBase Cloud Database Query Performance
From Slow Query identification to adding Indexes, avoiding Full Collection Scans, using Aggregation Pipelines instead of multiple queries, field projection, and cursor Pagination — each step explained with its underlying mechanism and applicable limits, without fabricated benchmark numbers.
Read and Write CloudBase Database in WeChat Mini Program
After login, use the db API from @cloudbase/js-sdk to perform collection CRUD, conditional queries, and real-time watch subscriptions in a WeChat Mini Program frontend, including Permission Mode selection and unsubscribe considerations.
Realtime Notifications with CloudBase Database watch
In a WeChat Mini Program with authentication already integrated, use db.collection().watch() to push order status updates, message alerts, and online presence sync. Covers the initial snapshot, docChanges increments, connection management, and when to call close().