|| Term || Definition|| | 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 |

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. {code:none} POST /wonderland/foobar > Content-Type: application/json {"foo": "bar"} < 409 < Content-Type: application/json < Content-Length: 74 {"error":"key_eexists","reason":"Key exists (with a different CAS value)"} {code}

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. {code:none} DELETE /wonderland/bill-the-lizard > X-Couchbase-CAS: 2678097998852587520 < 409 < Content-Type: application/json < Content-Length: 74 {"error":"key_eexists","reason":"Key exists (with a different CAS value)"} {code}

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. {code:none} GET /wonderland/hatter < 200 < Content-Type: application/json < Content-Length: 36 < X-Couchbase-CAS: 14571488446784471040 {"name": "Hatter", "species": "human"} {code}

In case when the given document ID isn't exist in the bucket you will get {{404 Not Found}} {code:none} GET /wonderland/red-queen < 404 < Content-Type: application/json < Content-Length: 45

{"error":"key_enoent","reason":"No such key"} {code}

h2. Couchbase Views

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):