Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 4266 invoked from network); 31 Dec 2008 22:58:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Dec 2008 22:58:25 -0000 Received: (qmail 62987 invoked by uid 500); 31 Dec 2008 22:58:24 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 62945 invoked by uid 500); 31 Dec 2008 22:58:24 -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 62932 invoked by uid 99); 31 Dec 2008 22:58:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Dec 2008 14:58:24 -0800 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.198.228 as permitted sender) Received: from [209.85.198.228] (HELO rv-out-0506.google.com) (209.85.198.228) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Dec 2008 22:58:17 +0000 Received: by rv-out-0506.google.com with SMTP id g37so5581908rvb.35 for ; Wed, 31 Dec 2008 14:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=QoubdKxrDbAQ4iH7J1ErfOkL76uW/YxSDmOpoLiIF0s=; b=H6pd0n/Ke4QQUCnz0Qh7LuFKXnbhqaLKx4w4J/rU9OmybdGBeC1OFmtz8Zm+BhEIqZ 9RimupTvjq+0fZiRf4iqcmL6tbegpns6lQt/SvOm/WSDv8x9bl9v9477ntIzwgxUA/hR FUchJ6aXGaj94WhBaYDE9a0ePqM6wu+OEKj5E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=to9/WnElGGFRdGOJGcf6W7ZF22Nmp2+C04BeTZVq1Dn80sUquCi6HU2bwrsj+QmJ4T xvVOCu7ZfOXjfNRTy57n/5+ITnNWyv+aShyyT1zSZvWVkKLmknkfktEBlbl3AguwA7zD /ZMMRh3dHmuVukid3HzjoWOvuWMyxvnKoNum8= Received: by 10.140.201.21 with SMTP id y21mr8028970rvf.102.1230764276463; Wed, 31 Dec 2008 14:57:56 -0800 (PST) Received: by 10.141.75.15 with HTTP; Wed, 31 Dec 2008 14:57:56 -0800 (PST) Message-ID: Date: Wed, 31 Dec 2008 17:57:56 -0500 From: "Paul Davis" To: user@couchdb.apache.org Subject: Re: group_level and intermediate reduce results In-Reply-To: <905d10ce0812311448p756d8931h8600491f1c847ca7@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <905d10ce0812311448p756d8931h8600491f1c847ca7@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Dec 31, 2008 at 5:48 PM, Scott Robertson wrote: > I think I understand how group_level works. Is there a way to get the > results of multiple levels with one get? > > For example say I'm creating a view that counts how many documents a > member has created and how many docs all the members of each group has > created. Using a two part key. > > My map would look something like this > > function(doc){ > emit([doc.group, doc.member], 1); > } > > And my reduce sums the values > > function(keys, values){ > return sum(values); > } > > I can get the counts for each member like this > http://localhost:5984/mydb/_view/sums/all?group_level=2 > > Which return something like > > key | value > ================================== > [group1,member1] | 5 > [group1,member2] | 3 > [group1,member3] | 1 > [group2,member4] | 1 > > And I can get the sums for each group > http://localhost:5984/mydb/_view/sums/all?group_level=1 > > key | value > ================================== > [group1] | 9 > [group2] | 1 > > Is there away that I can request those values merged, so that it looks > like this? > > key | value > ================================== > [group1] | 9 > [group1,member1] | 5 > [group1,member2] | 3 > [group1,member3] | 1 > [group2] | 1 > [group2,member4] | 1 > > W/o having to make two separate requests? > No, not at the moment. The way the group_level is implemented you'd basically need to fold over the view twice or make that work.