The config section above tell nginx to use {{/wonderland/}} mount point to expose Couchbase API.

By default only Document API will be mounted, i.e. only CRUD operations can be executed there. Because in Couchbase itself both Document and Views APIs lives in completely different namespaces, the nginx module also keeps them separate. The example below will mount views and the documents into the common root.

The snippet above will translate this URI {{/storage/foo?cmd=replace&exptime=40}} to the {{replace "foo" ...}} command with expiration of 40 seconds. In the same way can be controller ID, value, flags and expiration time.

The rest of the section demonstrates various example of usage the API, including optimistic locking with CAS. It assumes the following config:

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 ETag value)"} {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}