Couchbase Server 4.0

Agile development with JSON + SQL.

What's Couchbase Server? section

What's Couchbase Server?

Couchbase Server is an open source NoSQL database.

It is a high-performance document database.
The data model is flexible. The query language is powerful.
It is easy to scale — add nodes and rebalance the data.

Query, Scale, Repeat section

Querying with N1QL

N1QL enables you to query a document database without limitations and without compromise - sort, filter, transform, group, and combine data with a query. That’s right. You can combine data from multiple documents with a JOIN. That flexible data model you were promised? This is it. You’re no longer limited to “single table” and “table per query” data models.

N1QL is a declarative query language that extends SQL for JSON. However, developers can rely on native framework integration or a fluent API to build queries in addition to writing query statements.

// Query Statement
SELECT * FROM databases WHERE category='NoSQL'

// Results

  "name": "Couchbase Server 4.0",
  "version": "GA",
  "category": "NoSQL",
  "features": [
      "name": "N1QL",
      "capabilities": [
        "JOIN", "NEST", "UNNEST"

N1QL Query Documentation

// Fluent API

// Query Statement
bucket.query(Query.simple("SELECT name FROM databases WHERE category='NoSQL'"));

Java Query Documentation

var query = from db in bucket.Queryable<DataBases>(bucket) where db.category == "NoSQL"

.NET Query Documentation

bucket.query(couchbase.N1qlQuery.fromString("SELECT name FROM databases WHERE category='NoSQL'"));

Node.js Query Documentation

$bucket->query(CouchbaseN1qlQuery::fromString("SELECT name FROM databases WHERE category='NoSQL'"));

PHP Query Documentation

cmd.query = "SELECT name FROM databases WHERE category='NoSQL'";

C/C++ Query Documentation

bucket.n1ql_query(N1QLQuery("SELECT name FROM databases WHERE category='NoSQL'"))

Python Query Documentation

You can improve query performance with secondary indexes. Want to create a bunch of indexes? Go for it. Want to create a compound index on multiple fields? Go for it. Worried about what will happen to query performance as the number of nodes increases? Don't. We implemented global secondary indexes. The key word being "global". A global secondary index is not partitioned. It's a whole index. After all, it's a lot faster to check a whole index on one node than it is to check a partial index on every node.

What's Couchbase Server? section Try It

Try It

Download, explore the reference app, see some code, and run a few queries.