Couchbase Developer flashcards
Couchbase Developer · Build recall with a focused review session.
32 cards. Read the term and the definition here. The deck at the top of this page is optional.
- Document key design
- Keys must be unique per bucket and should spread writes across vBuckets; include a high-cardinality component such as a user ID or counter to avoid hot spots.
- Embed vs reference
- Embed bounded child data read with the parent; reference large, shared, or independently updated data. Couchbase has no joins, so N1QL JOIN is the only cross-document option.
- USE KEYS clause
- N1QL SELECT ... USE KEYS ['doc::1'] fetches documents directly by key without an index scan, making point reads fast and predictable.
- Covering index
- An index that includes all fields a query needs (via INCLUDE) so the query engine answers from the index without fetching the document, reducing latency and I/O.
- request_plus consistency
- A scan consistency mode where the query waits until indexes have caught up with the request time, guaranteeing read-after-write at the cost of added latency.
- UNNEST in N1QL
- UNNEST flattens an array field into rows so each element can be filtered or joined; use it to query inside arrays without application-side processing.
- MERGE statement
- N1QL MERGE INTO target USING source ON condition performs conditional insert, update, or delete in one statement, useful for upsert-style logic.
- EXPLAIN plan
- EXPLAIN returns the query plan; a primary scan over the whole bucket indicates a missing or unused secondary index and should be fixed before production.
- Scope and collection
- Couchbase 7.0+ logical containers inside a bucket; collections group documents and indexes, while scopes group collections, enabling multi-tenant isolation without separate buckets.
- Cluster.connect
- SDK 3.x entry point: Cluster.connect('couchbase://host', options) returns a Cluster; then call bucket(), scope(), and collection() to reach data.
- CAS optimistic concurrency
- Each document has a CAS value; pass the CAS from a read into replace or mutateIn. A mismatch throws CasMismatchException, signaling a concurrent modification.
- Durability levels
- MutateInOptions durability (MAJORITY, PERSIST_TO_MAJORITY) or PersistTo/ReplicateTo control how many replicas must acknowledge a write before it returns.
- Sub-document operations
- lookupIn and mutateIn read or modify specific paths inside a document without transferring the whole body, reducing bandwidth and latency for large documents.
- Error classification
- SDK errors fall into transient (retry with backoff), ambiguous (outcome unknown, re-read), and permanent (do not retry); correct classification prevents duplicate writes.
- SDK transactions
- Couchbase 7.0+ transactions run via cluster.transactions().run(lambda); operations inside commit atomically across collections and roll back on failure.
- GetResult contentAs
- GetResult.contentAs(Class) deserializes the document body; check exists() first because a missing document returns an empty result rather than throwing.
- Reactive and async APIs
- Java, .NET, and Node.js SDKs offer reactive or async variants; blocking calls on event-loop threads cause stalls, so use async methods in those runtimes.
- Connection string schemes
- couchbase:// uses plain TCP; couchbases:// enables TLS. The string lists seed nodes and optional options such as timeouts and compression.
- vBuckets
- Each bucket is divided into 1024 vBuckets distributed across data nodes; rebalance moves vBuckets to equalize load and replicas protect them during node loss.
- Graceful vs hard failover
- Graceful failover waits for data to be replicated before removing a node; hard failover removes it immediately and may lose unreplicated writes.
- Auto-failover
- A cluster setting that triggers failover after a node is unresponsive for a configured timeout; it requires at least one replica to preserve availability.
- Bucket RAM quota
- The memory allocated to a bucket's cache; too small a quota causes frequent disk fetches, while too large a quota starves other services on the node.
- cbbackupmgr
- The backup and restore tool for Couchbase; it supports full and incremental backups, merges, and restore to a cluster, and should be tested regularly.
- RBAC roles
- Role-based access control assigns privileges such as data reader, data writer, or query to users; applications should use least-privilege accounts, not Administrator.
- Rolling upgrade
- Upgrade one node at a time, rebalancing after each, so the cluster stays online; verify SDK and index compatibility before starting.
- Service placement
- Data, index, query, search, analytics, and eventing services can run on selected nodes; placement affects failover capacity and query performance.
- Couchbase Lite
- An embedded NoSQL database on mobile and edge devices; it stores documents locally and replicates with Sync Gateway or Couchbase Server.
- Sync Gateway
- The server component that authenticates mobile clients and replicates documents between Couchbase Lite and Couchbase Server using the replication protocol.
- Push vs pull replication
- Push sends local changes to the server; pull fetches remote changes to the device. Continuous replication keeps both running, one-shot runs once.
- Conflict resolution
- When the same document changes on device and server, Couchbase Lite resolves conflicts with a default last-write-wins rule or a custom conflict handler.
- Channels and roles
- Sync Gateway assigns documents to channels via the sync function; users with access to a channel receive those documents during replication.
- Delta sync
- A replication optimization that sends only changed document fields instead of full bodies, reducing bandwidth for mobile and edge connections.