Couchbase Database Management in VS Code
Overview
Section titled “Overview”Couchbase is a distributed NoSQL document database combining the flexibility of JSON with the power of SQL++ (N1QL) queries. Key characteristics include:
- JSON document model: Store schema-flexible JSON documents in collections
- SQL++ (N1QL) querying: Familiar SQL syntax extended for JSON, including JOINs, UNNEST, and subqueries
- Multi-level hierarchy: Buckets contain Scopes, which contain Collections - mapping naturally to databases, schemas, and tables
- High availability: Built-in replication, automatic failover, and cross-datacenter replication (XDCR)
- Cloud and self-hosted: Available as Couchbase Server (on-premises or self-managed) and Couchbase Capella (fully managed cloud)
Couchbase is used for user profiles, session management, content management, real-time analytics, and applications requiring low-latency reads and writes at scale.
Connecting
Section titled “Connecting”To connect to Couchbase in DBCode:
- Open the DBCode Extension: Launch Visual Studio Code and open the DBCode extension.
- Add a New Connection: Click on the “Add Connection” icon.
- Complete the connection form: Select Couchbase as the database type and enter:
- Host: hostname or IP of your Couchbase node (or Capella endpoint)
- Port: management port (default: 8091); the query service is auto-discovered
- SSL/TLS: enable for Couchbase Capella and any TLS-secured cluster
- Username / Password: Couchbase RBAC credentials, or choose a Command auth profile
- Connect: Click save to connect to your cluster.
- Start exploring: Browse buckets, scopes, and collections.
DBCode connects over HTTP/REST - no native Couchbase client or SDK is required. Works with both Couchbase Server (self-hosted) and Couchbase Capella (cloud).
For detailed connection instructions, refer to the Connect article.
Data Model
Section titled “Data Model”Couchbase’s hierarchy maps to familiar database concepts in DBCode:
| Couchbase | DBCode |
|---|---|
| Bucket | Database |
| Scope | Schema |
| Collection | Table |
Documents are JSON. DBCode infers column structure by sampling documents via Couchbase INFER, so all columns are nullable. The document key is surfaced as a synthetic id column.
Couchbase Features in DBCode
Section titled “Couchbase Features in DBCode”DBCode enhances your Couchbase development experience with:
- SQL++ query editor: Write and execute N1QL/SQL++ queries with syntax highlighting; multi-statement scripts are supported
- Document browsing: Navigate buckets, scopes, and collections with row counts and inferred schemas
- Document editing: Edit, insert, and delete documents inline in the data grid or JSON inspector (key-addressed SQL++ under the hood)
- Structural management: Create and drop scopes and collections; create, drop, and flush buckets
- Data export: Export query results in multiple formats
Preview limitations
Section titled “Preview limitations”Couchbase support is in Preview. Some N1QL-specific syntax (UNNEST, NEST, USE KEYS, and certain index hints) may not get full editor IntelliSense yet.
By using Couchbase with DBCode, you can query and manage your document data directly within Visual Studio Code.
For more information about Couchbase, visit couchbase.com.