Return-Path: Delivered-To: apmail-incubator-couchdb-user-archive@locus.apache.org Received: (qmail 52637 invoked from network); 1 Oct 2008 03:15:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Oct 2008 03:15:57 -0000 Received: (qmail 37448 invoked by uid 500); 1 Oct 2008 03:15:55 -0000 Delivered-To: apmail-incubator-couchdb-user-archive@incubator.apache.org Received: (qmail 37412 invoked by uid 500); 1 Oct 2008 03:15:55 -0000 Mailing-List: contact couchdb-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-user@incubator.apache.org Delivered-To: mailing list couchdb-user@incubator.apache.org Received: (qmail 37401 invoked by uid 99); 1 Oct 2008 03:15:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2008 20:15:54 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kowsik@gmail.com designates 74.125.92.148 as permitted sender) Received: from [74.125.92.148] (HELO qw-out-1920.google.com) (74.125.92.148) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Oct 2008 03:14:52 +0000 Received: by qw-out-1920.google.com with SMTP id 4so89570qwk.54 for ; Tue, 30 Sep 2008 20:15:16 -0700 (PDT) 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=cugzTdB2uAK/cUnggKdkDoLEDm2m9u1U8QXcKkVJXNg=; b=rLdn2/k1mIzVRtUUcnznT6fRnByM6AnHU1e5vvcBx63mv6Lv2V4PHuA8Lm+4i/OgcB grKGRLzDVstlqmRaL6iF4J/jRWVCEQ4Ku3KuJXKNCQzUjg4O6s9FSlZgKriljmlEZxTu 2VaI5QSvRfWjABJRPK44/dGlZe6Yu/zoieeNk= 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=s/k4LF8GVQYZO0qSc6/rYz7bebWHyFevEyzqVK9iPwp3HzJ3B59VPfRKo6T1Kc4lJy Ptfl8Tn7HBTda0oJ09sMCsZ1qnwD3UM7cAiRFRV5VQQmadRH6CQbfp/W8rAk3xgHVZ7q zbyoeAVnF5QAVRRVzUFLqJkWouJh8Ay0ZErW8= Received: by 10.214.10.18 with SMTP id 18mr7750325qaj.74.1222830916830; Tue, 30 Sep 2008 20:15:16 -0700 (PDT) Received: by 10.214.26.21 with HTTP; Tue, 30 Sep 2008 20:15:16 -0700 (PDT) Message-ID: <7db9abd30809302015y73b5448bja173913cf40a5d2f@mail.gmail.com> Date: Tue, 30 Sep 2008 20:15:16 -0700 From: kowsik To: couchdb-user@incubator.apache.org Subject: Re: Top 10 sorted by value... In-Reply-To: <6dfc41e10809301826s2ca56a5dn87bd378cdcb87984@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7db9abd30809301754t3fce914dr61befd2897170140@mail.gmail.com> <6dfc41e10809301826s2ca56a5dn87bd378cdcb87984@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Going through all responses, so I'm sure there's another answer further down. Noah, this doesn't work since it sorts by 'key'. I want the top 10 sorted by 'value'. In other words I want the result to be: { key: "b", value: 12 }, { key: "a", value: 10 }, { key: "c", value: 1 } and so on. K. On Tue, Sep 30, 2008 at 6:26 PM, Noah Tye wrote: > On Tue, Sep 30, 2008 at 5:54 PM, kowsik wrote: >> I have a data set where my map reduce returns data like so: >> >> { key: "a", value: 10 }, >> { key: "b", value: 12 }, >> { key: "c", value: 1 }, >> ... >> >> Potentially this could be fairly large, even after the reduce. Is >> there any way to: >> >> 1. sort these by descending values? I only want the top 10. > > count=10 > >> 2. page through them in the sorted order? > > startkey= > > Take a look at , in the > section "Querying Options". > > -- > ''=~('(?{'.('/))./@'^'_[@@[`').'"'.('./](@{"[^'^'`@<@`/[>|').',$/})') > noah@tyes.us | http://noah.tyes.us > "They copied all they could follow, but they couldn't copy my mind, > And I left 'em sweating and stealing a year and a half behind." >