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 "Views" by MichaelHendricks
Date Thu, 11 Sep 2008 14:20:26 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 MichaelHendricks:
http://wiki.apache.org/couchdb/Views

The comment on the change is:
briefly mention reduce functions

------------------------------------------------------------------------------
  
  == Basics ==
  
+ === Map Functions ===
+ 
- Here is the simplest example of a view function:
+ Here is the simplest example of a map function:
  
  {{{
  function(doc) {
@@ -89, +91 @@

  
  ''This example output was reformatted for readability.''
  
+ === Reduce Functions ===
+ 
+ '''This section is only a stub.  Please help by expanding it.'''
+ 
+ Here is an example of a reduce function:
+ 
+ {{{
+ function (keys, values, combine) {
+     return sum(values);
+ }
+ }}}
+ 
+ Reduce functions should return a single scalar value.
+ 
  == Lookup Views ==
  
  The second parameter of the ''emit()'' function can be ''NULL''. CouchDB then only stores
the key in the view. If you use the document's ID here, you can use the view as a compact
lookup mechanism and fetch the document's details, if needed, in subsequent requests.

Mime
View raw message