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 "View_server" by ThomasVanderStichele
Date Sat, 21 Apr 2012 20:03:45 GMT
Dear Wiki user,

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

The "View_server" page has been changed by ThomasVanderStichele:
http://wiki.apache.org/couchdb/View_server?action=diff&rev1=32&rev2=33

Comment:
Small input/output fixes based on unittests written for query servers

  CouchDB sends:
  
  {{{
- ["add_fun", "function(doc) { if(doc.score > 50) emit(null, {"player_name": doc.name});
}"]\n
+ ["add_fun", "function(doc) { if(doc.score > 50) emit(null, {'player_name': doc.name});
}"]\n
  }}}
  When the view server can evaluate the function and make it callable, it returns:
  
@@ -78, +78 @@

  The views server answers:
  
  {{{
- [[[]]]\n
+ [[]]\n
  }}}
  === 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]}}}.
@@ -86, +86 @@

  CouchDB sends:
  
  {{{
- ["reduce",["function(k, v) { return sum(v); }"],[[[1,"699b524273605d5d3e9d4fd0ff2cb272"],10],[[2,"c081d0f69c13d2ce2050d684c7ba2843"],20],[[null,"foobar"],3]]]
+ ["reduce",["function(k, v) { return sum(v); }"],[[[1,"699b524273605d5d3e9d4fd0ff2cb272"],10],[[2,"c081d0f69c13d2ce2050d684c7ba2843"],20],[[null,"foobar"],3]]]\n
  }}}
  
  The view-server answers:
  
  {{{
- [true, [33]]
+ [true, [33]]\n
  }}}
  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.
  
@@ -104, +104 @@

  CouchDB sends:
  
  {{{
- ["rereduce",["function(k, v, r) { return sum(v); }"],[33,55,66]]
+ ["rereduce",["function(k, v, r) { return sum(v); }"],[33,55,66]]\n
  }}}
  The view-server answers:
  
  {{{
- [true, [154]]
+ [true, [154]]\n
  }}}
  === log ===
  At any time, the view-server may send some information that will be saved in CouchDB's log
file. This is done by sending a special object with just one field, {{{log}}}, on a separate
line.
@@ -117, +117 @@

  The view-server sends
  
  {{{
- ["log", "A kuku!"]
+ ["log", "A kuku!"]\n
  }}}
  CouchDB answers nothing.
  

Mime
View raw message