incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kowsik <kow...@gmail.com>
Subject Re: Top 10 sorted by value...
Date Wed, 01 Oct 2008 03:15:16 GMT
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 <noah@tyes.us> wrote:
> On Tue, Sep 30, 2008 at 5:54 PM, kowsik <kowsik@gmail.com> 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=<wherever you want to start>
>
> Take a look at <http://wiki.apache.org/couchdb/HttpViewApi>, 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."
>

Mime
View raw message