Couchbase Server is an open source, distributed NoSQL document-oriented database. It exposes a fast key-value store with managed cache for submillisecond data operations, purpose-built indexers for fast queries and a query engine for executing SQL-like queries.
Couchbase documents are JSON, a self-describing format capable of representing rich structures and relationships. Unlike a traditional RDBMS, the schema in Couchbase Server is a logical construct entirely defined in the application code and captured in the structure of the stored documents.
Unlike other NoSQL databases, Couchbase supports JOIN operations, which enables a wide range of data models.
Couchbase Server is a true operational store that serves end customer requests directly. This contrasts with Hadoop and Spark, which are primarily analytic and machine learning environments that are accessed by analysts and data scientists and which tolerate orders of magnitude more latency.
The system never needs to be taken offline for routine maintenance such as software upgrades, index building, compaction, hardware refreshes, or any other operation.
N1QL (pronounced “nickel”) is the Couchbase Server query language.
Limit and is not missing
JSON documents can contain NULL values or omit fields entirely. The NULL/MISSING operators let you test for these conditions.
Documents in the travel app data model
One of the most powerful features available in the Couchbase Query API is the ability to UNNEST or flatten,the results returned in the SELECT statement. In the data model for the travel application, each route document contains a nested collection of schedule documents. To alleviate a complicated JSON parsing code pattern for the return results, you can UNNEST the schedule documents, so they become the root-level fields in the returned results.
Here’s an example of a query that finds flights between Seattle-Tacoma International Airport (SEA) and Orlando International Airport (MCO).
Accessing a Secure Bucket
For the ‘beer-sample’ bucket, if you add a password to it of w1fg2Uhj89
(as by default it has none), the command to start cbq would
look like this:
How to select using the document key id?
Matching Elements in Nested Arrays with ANY
Combining Multiple Conditions with AND
Querying primary keys