CouchDB Document Update Handlers (in-place updates)

The example function in-place is not the same as “in-place” updates in other databases. CouchDB still uses an append-only architecture; document update handlers still create a new doc revision, etc. Still, update handlers are quite convenient and worth learning. Suppose you have a document with an accumulator. You want to accumulate an integer in a … Read more

CouchApps and user authentication

CouchDB has released a simple authentication api but has no in built authentication mechanisms as of yet. The simplest and easiest way to do this is to use an http proxy for authentication. However this has limitations on how much you can restrict access on a per document basis. When CouchDB gets some more support … Read more

CouchDB a real world example

The upcoming book by O’Reilly is free to read online: http://books.couchdb.org/relax/ Just install and play around – you can do straight http requests using curl on the command line, or use the built-in web interface called futon. Storing and retrieving data is really easy, the hardest part is thinking in terms of map/reduce-views instead of … Read more

Dealing with conflicts caused by replication in BigCouch

Get the revision number of the document to be updated if there is a conflict during attachment and recursively call in-case of a conflict, $url = “http://couchdb/DATABASE/DOCID/ATTACHMENTNAME?rev=$rev”; curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_PUT, true ); curl_setopt( $ch, CURLOPT_URL, $url ); curl_exec( $ch );

Creating regular users in CouchDB

First you put the user in _users database. The ID of the document must be org.couchdb.user:username, e.g. With CouchDB 1.2.0 or later use this: { “_id”: “org.couchdb.user:dbreader”, “name”: “dbreader”, “type”: “user”, “roles”: [], “password”: “plaintext_password” } CouchDB will hash & salt the password for you on the server side and save the values in the … Read more

tech