couchbase
/couchbase
Expert Couchbase NoSQL assistance covering N1QL/SQL++ queries, memory-first caching, document scopes, and cross-datacenter replication (XDCR). Use when building ultra-low latency JSON document platforms.
- Author
- G1Joshi ↗
- Repository
- Agent-Skills ↗
- Licence
- MIT
- Last repository change
- 01.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Expert Couchbase NoSQL assistance covering N1QL/SQL++ queries, memory-first caching, document scopes, and cross-datacenter replication (XDCR). Use when building ultra-low latency JSON document platforms.
Original author description
Expert Couchbase NoSQL assistance covering N1QL/SQL++ queries, memory-first caching, document scopes, and cross-datacenter replication (XDCR). Use when building ultra-low latency JSON document platforms.
How it works
- When to Use
- Quick Start
- Core Concepts
- Common Patterns
- Best Practices
- Troubleshooting
- References
SKILL.md preview
---
name: couchbase
description: Expert Couchbase NoSQL assistance covering N1QL/SQL++ queries, memory-first caching, document scopes, and cross-datacenter replication (XDCR). Use when building ultra-low latency JSON document platforms.
---
# Couchbase
Couchbase works as a Key-Value store (managed memory cache) + Document Database. It is famous for its "memory-first" architecture and N1QL (SQL for JSON).
## When to Use
- **Memory-First NoSQL Document Store**: Applications requiring sub-millisecond document lookups powered by an integrated managed memory cache.
- **SQL for JSON (N1QL / SQL++)**: Querying JSON documents using familiar SQL syntax with joins, nested arrays, and subqueries.
- **Distributed Key-Value + Full-Text Search**: Unifying key-value caching, document storage, and vector/full-text search in a single cluster.
- **Mobile Edge Data Sync (Couchbase Lite)**: Synchronizing embedded mobile database instances with cloud clusters using Sync Gateway.
## Quick Start
```sql
-- N1QL Query
SELECT u.name, ARRAY_AGG(o.item) as orders
FROM `travel-sample`.inventory.users u
JOIN `travel-sample`.inventory.orders o ON u.id = o.user_id
WHERE u.city = "Paris"
GROUP BY u.name;
```
## Core Concepts
### Memory-First VBucket Architecture
Documents are mapped across 1024 virtual buckets (vBuckets), cached directly in RAM before being asynchronously written to disk:
```text
[ Application Client ] ──Sub-Millisecond Read/Write──→ [ Managed Memory Cache (RAM) ]
│ (Async Flush)
▼
[ Append-Only Disk Storage ]
```
### SQL++ (N1QL) Declarative JSON Queries
Executes full SQL expressions over schemaless JSON structures:
```sql
-- Query nested JSON orders in Couchbase SQL++
SELECT
meta().id AS orderId,
customer.email,
ARRAY_SUM(items[*].price) AS totalAmount
FROM `commerce`.`orders` AS o
WHERE status = 'PAID'
AND ANY item IN items SATISFIES item.category = 'Electronics' END
ORDER BY totalAmount DESC
LIMIT 20;
```
### Scopes and Collections Multi-Tenancy
Organizes documents into logical namespaces mimicking relational databases:
```text
[ Bucket: enterprise ]
├── [ Scope: billing ]
│ ├── [ Collection: invoices ]
│ └── [ Collection: payments ]
└── [ Scope: catalog ]
└── [ Collection: products ]
```
## Common Patterns
### SQL++ (N1QL) Secondary Indexing and Querying
**Problem**: Ad-hoc JSON document filtering results in slow primary index table scans.
**Solution**:
Build covering secondary GSI indexes for high-throughput queries:
```sql
CREATE INDEX idx_orders_status ON `ecommerce`.`sales`.`orders` (customerId, orderStatus, orderDate)
WHERE orderStatus != 'cancelled';
SELECT customerId, orderDate, total
FROM `ecommerce`.`sales`.`orders`
WHERE customerId = "cust_987" AND orderStatus = "completed"
ORDER BY orderDate DESC;
```
## Best Practices
**Do**:
- Use Sub-Document API for Partial Mutations: Mutate specific JSON array items or attributes without fetching/resaving the entire document.
- Create Global Secondary Indexes (GSI) Covering Queries: Index the exact fields in `WHERE` and `SELECT` to enable index-only scans.
- Leverage Key-Value Operations for Hot Lookups: Use `get()` and `upsert()` key-value APIs for sub-millisecond reads rather than N1QL queries.
- Size Bucket RAM Quotas Carefully: Allocate sufficient RAM to ensure high active working set cache-hit ratios.
**Don't**:
- Use Primary Indexes in Production: Avoid `CREATE PRIMARY INDEX`; primary scans scan all documents in the collection.
- Store massive binary blobs in documents: Keep documents under 1MB; store images and media in object storage.
- Ignore Cross-Datacenter Replication (XDCR) lag: Monitor XDCR replication queues when synchronizing across multi-region clusters.
## Troubleshooting
| Error | Cause | Solution |
| :---------------------------------- | :------------------------------------------------------------------- | :------------------------------------------------------------------------------------ |
| `No index available for query` | Missing secondary index matching the WHERE predicate in SQL++ query. | Create an index covering query filter and projection columns. |
| `Temporary failure / Out of memory` | Couchbase bucket memory quota exhausted by high item count. | Increase bucket RAM quota or configure eviction policy (value-only vs full eviction). |
| `DocumentExistsException` | Key already exists in bucket during insert operation. | Use `upsert` instead of `insert` if overwrite semantics are intended. |
## References
- [Couchbase Documentation](https://docs.couchbase.com/home/index.html)
Versions
The database has no other skills named couchbase.
Database snapshot: 13.11.2026 · package version 89e3b270af47 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 80role-database:document-databases
Deep operational guide for 12 document databases. MongoDB (aggregation pipeline, sharding, Atlas, CSFLE, Vector Search), Elasticsearch/OpenSearch (ILM, mapping, query DSL, tiering), CouchDB (multi-master, PouchDB), Couchbase (N1QL, XDCR, Capella), RavenDB, DocumentDB, Cosmos DB,… - 100haproxy
Expert HAProxy load balancer assistance covering Layer 4 / Layer 7 routing, health checks, SSL termination, and rate limiting. Use when building high-availability, low-latency traffic proxies. - 100modeling-nosql-data
Build use when you need to work with NoSQL data modeling. This skill provides NoSQL database design with comprehensive guidance and automation. Trigger with phrases like "model NoSQL data", "design document structure", or "optimize NoSQL schema". - 100modeling-nosql-data
Build use when you need to work with NoSQL data modeling. This skill provides NoSQL database design with comprehensive guidance and automation. Trigger with phrases like "model NoSQL data", "design document structure", or "optimize NoSQL schema". - 100cosmosdb
Expert Azure Cosmos DB assistance covering NoSQL API, partition key design, Request Units (RU/s) optimization, and change feed. Use when building globally distributed, multi-master Azure applications. - 100database-designer
Use when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.