couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <>
Subject Changes in trunk
Date Wed, 21 May 2008 18:08:30 GMT
Dear CouchDB aficionados,
we made a couple of changes in trunk that are
not backward compatible with earlier versions
of CouchDB. Theses are necessary changes
and we do them now in preparation for an 0.8

If you have software that uses CouchDB, it is
likely to require changing. Sorry about that :-)

The changes in detail:

Views now support optional reduce. For this
to work, the structure of view documents
had to change. An example is probably the
best way to illustrate them:

   "views": {
     "bar": {
       "map":"function... ",

Notable changes are the usage of a JSON object
to define both the map and the reduce function instead
of just a string for the map function. Again, the reduce
member may be omitted.

The "language" member is no longer a "proper"
MIME-Type, instead, only the actual language's
name is stated.

Confusingly, we used a "map()" function to be used
within the actual map function (or view function) to
place a key and value in a view's result list. This
function is now called "emit()" to avoid confusion.

function(doc) {
   emit(, null);

Temporary views now need to get POSTed a
proper JSON document with map and reduce
members instead of just posting in the map function's


Note that the language of the view functions is no
longer determined by the Content-Type header of
the HTTP request. Since the definition is a JSON object,
the Content-Type is always application/json.


You specify the language of the temp view in an optional
"language" member. If omitted, it's value defaults to

View raw message