You can find executable spec here: http://docs.couchbasenginx.apiary.io/
This document describes the REST API exposed to access Couchbase
There are several terms we are using while describing this API.
|document||Arbitrary JSON or BLOB value. It could be referenced by its ID|
|bucket||The logical storage, which contains the documents. Like database in SQL world, or collection in mongodb|
Lets assume we have a bucket named wonderland.
Create document in the bucket
You can also specify ID with POST request if you need to create the document with given ID.
Note that when you are using POST request, the server is always supposed to create the new document. This means that you will get an error if the document already exists.
Update the document
You can also specify X-Couchbase-CAS header and the server will perform optimistic lock before updating. This operation might fail on CAS mismatch
If the document being updated doesn't exist, you will get 404 Not Found error
Removing document from the bucket
You can also specify CAS value if you need to ensure you are removing know version of the document. In case of CAS mismatch you will get an error.
If the document being removed doesn't exist, you will get 404 Not Found error
Getting the document by ID. You can also control expiration time of the key using X-Couchbase-TTL header. The argument should be a ASCII representation of 32-bit number, which interpreted as absolute time in seconds if it is less than 30 * 24 * 60 * 60 or epoch time otherwise.
In case when the given document ID isn't exist in the bucket you will get 404 Not Found
One of the features of the Couchbase is ability to build efficient indexes leveraging Map/Reduce. They are called Views and you can define them on Admin Console UI.
This module allows you to query your views proxying them to Couchbase. All arguments will be transparently passed to Couchbase and the result will be streamed back.
For example we have a view all defined in the design document characters. It is simple map which will just emit all known characters (without any reduce function):
The result will look like
You can pass the any of supported query parameters, like include_docs=true for example: