You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2010/05/02 20:21:08 UTC

[Couchdb Wiki] Trivial Update of "View_Snippets" by SebastianCohnen

Dear Wiki user,

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

The "View_Snippets" page has been changed by SebastianCohnen.
http://wiki.apache.org/couchdb/View_Snippets?action=diff&rev1=37&rev2=38

--------------------------------------------------

  = View Snippets =
  <<TableOfContents()>>
  
- 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.
+ 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.
+ 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 ==
@@ -267, +267 @@

  
  
  == Computing the standard deviation ==
- This example is from the couchdb test-suite. It is '''much''' easier and less complex then following example ([[#summary_stats|Computing simple summary statistics (min,max,mean,standard deviation)]]) although it does not calculate min,max and mean (but this should be an easy exercise).
+ This example is from the couchdb test-suite. It is '''much''' easier and less complex then following example although it does not calculate min,max and mean (but this should be an easy exercise).
  
  {{{#!highlight javascript
  // Map