Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 2997 invoked from network); 19 Apr 2009 09:59:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Apr 2009 09:59:05 -0000 Received: (qmail 54300 invoked by uid 500); 19 Apr 2009 09:59:05 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 54205 invoked by uid 500); 19 Apr 2009 09:59:05 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 54196 invoked by uid 500); 19 Apr 2009 09:59:05 -0000 Delivered-To: apmail-incubator-couchdb-commits@incubator.apache.org Received: (qmail 54193 invoked by uid 99); 19 Apr 2009 09:59:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2009 09:59:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Apr 2009 09:59:04 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 09E09118BB for ; Sun, 19 Apr 2009 09:58:44 +0000 (GMT) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Apache Wiki To: couchdb-commits@incubator.apache.org Date: Sun, 19 Apr 2009 09:58:43 -0000 Message-ID: <20090419095843.10222.61305@eos.apache.org> Subject: [Couchdb Wiki] Update of "View Snippets" by WoutMertens X-Virus-Checked: Checked by ClamAV on apache.org 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: http://wiki.apache.org/couchdb/View_Snippets ------------------------------------------------------------------------------ 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 ==