couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "ViewServer" by RyszardSzopa
Date Sat, 14 Jun 2008 22:57:39 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 RyszardSzopa:
http://wiki.apache.org/couchdb/ViewServer

The comment on the change is:
reduce

------------------------------------------------------------------------------
  }}}
  
  That is, an array with the result for every function for the given document. If a document
is to be excluded from the View, the array should be empty.
+ === reduce ===
+ 
+ If the view has a {{{reduce}}} function defined, CouchDB will enter into the reduce phase.
The view server will receive a list of reduce functions and some map results on which it can
apply them. The map results are given in the form {{{[[key, id-of-doc], value]}}}.
+ 
+ CouchDB sends:
+ 
+ {{{
+ ["reduce",["function(k, v) { return sum(v); }"],[[[1,"699b524273605d5d3e9d4fd0ff2cb272"],10],[[2,"c081d0f69c13d2ce2050d684c7ba2843"],20],[[null,"foobar"],3]]]
+ }}}
+ 
+ The view-server answers:
+ 
+ {{{
+ [30]
+ }}}
+ 
+ Note that even though the view server receives the map results in the form {{{[[key, id-of-doc],
value]}}}, the function may receive them in a different form. For example, the JavaScript
view-server applies functions on the list of keys and the list of values.
+ 
+ === rereduce ===
  
  == Implementations ==
  

Mime
View raw message