Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 129B29C86 for ; Wed, 20 Jun 2012 09:10:18 +0000 (UTC) Received: (qmail 24283 invoked by uid 500); 20 Jun 2012 09:10:16 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 24092 invoked by uid 500); 20 Jun 2012 09:10:16 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 24062 invoked by uid 99); 20 Jun 2012 09:10:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jun 2012 09:10:15 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [74.125.82.54] (HELO mail-wg0-f54.google.com) (74.125.82.54) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jun 2012 09:09:57 +0000 Received: by wgbfg15 with SMTP id fg15so6378295wgb.23 for ; Wed, 20 Jun 2012 02:09:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:message-id:in-reply-to:references:subject:x-mailer :mime-version:content-type:x-gm-message-state; bh=0qWdtoKcITccReYqlFAjXauvaCpZG/3YTfB6CqPv1Zs=; b=WrAZuqomoxsP9+phVpQmTXVRrH9v7pRH9x8hGyBon0UEJwd036Heos++DiIG5DcEK+ /GbPe3LqoG+UHTgvfNirB0q7VMENMn0mCl8rdRjj8Bp4CgfBMUL7YqRPhi5RIF1R/nRb 32M3kDvhz5O4LcAcD3usd2vgdBC3Kz22citrt5fnEYeI3pBTSFP/L1U9ciFiKMfLgJOK bHr/6JdxW0jVBeQor+h9KYmbXsGpMNNwSxcNwZyXG8fLUkT0lL3ThBohlhs0oieJTRed EGgyeQXV4EpSkr0vSHZJJeLnCF+tikxAFnnRBUlDmJx03JE9IMS+VXVWdmwgYe4uvedf YXCQ== Received: by 10.180.81.36 with SMTP id w4mr10283811wix.16.1340183376465; Wed, 20 Jun 2012 02:09:36 -0700 (PDT) Received: from [10.10.10.57] (office.chillibean.net. [193.203.81.66]) by mx.google.com with ESMTPS id hs8sm22263689wib.10.2012.06.20.02.09.33 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jun 2012 02:09:35 -0700 (PDT) Date: Wed, 20 Jun 2012 10:09:29 +0100 From: Rory Franklin To: user@couchdb.apache.org Message-ID: <34DE079AB1D74E78A5167FD8B931B06B@chillibean.tv> In-Reply-To: References: <3CB7FA33-4ED6-4B80-97EC-A00FB1E8B9E9@gmail.com> Subject: Re: Reducing/Grouping an array X-Mailer: sparrow 1.6.1 (build 1081.52) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="4fe19349_41b71efb_164d6" X-Gm-Message-State: ALoCoQmMVPxneowtPP2NEeUhn/afFQtjYGDss79EqDZHJsJoIvdgTAyOBh+oH3FFmd2ETCoPQqXG --4fe19349_41b71efb_164d6 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks to both of you for the answer (sorry for my delayed reply!) - it works like a charm! Is this something that has appeared in recent versions of Couch? We had a database running on 1.0.1 that this didn't work on (upgrading to 1.2 fixed it though). Rory On Monday, 11 June 2012 at 18:58, Mark Hahn wrote: > map-reduce works on all types of obects or even lists of types > > On Mon, Jun 11, 2012 at 3:39 AM, Robert Newson wrote: > > > Sure, the built-in _sum reduce function works for lists of numbers too. > > > > B. > > > > On 11 Jun 2012, at 11:29, Rory Franklin wrote: > > > > > Hi, > > > > > > Is it possible to have a view that emits out something like the > > following: > > > > > > ("key1", [1,1,0,1]) > > > ("key1", [1,1,1,0]) > > > ("key1", [1,0,0,0]) > > > ("key2", [0,1,0,0]) > > > > > > which can be grouped to the following: > > > > > > "key1", [3,2,1,1] > > > "key2", [0,1,0,0] > > > > > > > > > Or would this calculation have to be made in the application layer? > > > > > > > > > Thanks, > > > Rory > > > > > > > > > > --4fe19349_41b71efb_164d6--