Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 30413 invoked from network); 21 Nov 2009 21:09:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Nov 2009 21:09:33 -0000 Received: (qmail 53626 invoked by uid 500); 21 Nov 2009 21:09:31 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 53538 invoked by uid 500); 21 Nov 2009 21:09:30 -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 53528 invoked by uid 99); 21 Nov 2009 21:09:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Nov 2009 21:09:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of guy.d.moulton@gmail.com designates 209.85.160.56 as permitted sender) Received: from [209.85.160.56] (HELO mail-pw0-f56.google.com) (209.85.160.56) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Nov 2009 21:09:22 +0000 Received: by pwj6 with SMTP id 6so2902507pwj.35 for ; Sat, 21 Nov 2009 13:09:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=MRzVahfisQFnMN20TkUHTpcztYMRJwij8Y7+mzLkJJo=; b=BDcwf5uH6FC7B6mNY9q26aOI80+YiiyZ6VVRta9xU/YuKAT59XnaP39udKY/YdeqJH Ioa08x71mFW5H2INV6uz6CS0xzJIuldIy9maa8rIWLgG6cx/rMW8QvI4d+5RL+XVtV+J WHPBlCRPQjE9yf5I/OrwJ2mHPG4I6Kg/tOVds= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=x7CLAsnaExTZKRSXQvVMsb0t7h/rAF/MDpbyDVCwTYZ7jsiWUa7lSj08q2giyh4mSR cfGY8FDE48OROzjjDsZmZ6fkQGrqJLhEAJW1A8nTDyVwyksyjDdS7bH7RkE6D2L3EQmS upBlg3MqAKDV1LxDtwbE6gbMFmFR9kC2eTLZg= MIME-Version: 1.0 Received: by 10.114.119.6 with SMTP id r6mr4667553wac.45.1258837741168; Sat, 21 Nov 2009 13:09:01 -0800 (PST) Date: Sat, 21 Nov 2009 21:09:01 +0000 Message-ID: <2f84d03e0911211309w58359625na39a3af812200fa@mail.gmail.com> Subject: Counting unique items From: Guy Moulton To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hello, I'm trying to get a count of the number of unique items in a database. Documents look like this: Item: Item_A, User: Dave Item: Item_A, User: John Item: Item_A, User: Jane Item: Item_B, User: John Item: Item_B, User: Anne In the above example, I'd like to know that there are 2 items. So far, I have a map/reduce that produces one view row for each kind of item (similar to the example on the wiki) : key: "Item_A", value:"Null" key: "Item_B", value:"Null" So the number I need is the number of rows in the view. According to the wiki, if I pass limit=0, it should give me the meta-data, but this doesn't seem to work on views that have a reduce function. I don't want to count rows in the client as there could potentially be a very large number. Any ideas would be very much appreciated. Regards, Guy