couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Couchdb Wiki] Update of "View Snippets" by WoutMertens
Date Sun, 19 Apr 2009 09:58:43 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by WoutMertens:

  This page collects code snippets to be used in your ["Views"]. They are mainly meant to
help get your head around the map/reduce approach to accessing database content. Keep in mind
that the the Futon web client silently adds group=true to your views.
+ == Common mistakes ==
+ When creating a reduce function, a re-reduce should behave in the same way as the regular
reduce. The reason is that CouchDB doesn't necessarily call re-reduce on your map results.
+ Think about it this way: If you have a bunch of values V1 V2 V3 for key K, then you can
get the combined result either by calling reduce([K,K,K],[V1,V2,V3],0) or by re-reducing the
individual results: reduce(null,[R1,R2,R3],1). This depends on what your view results look
like internally.
  == Get docs with a particular user id ==

View raw message