couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: sorting by reduce value
Date Fri, 03 Apr 2009 21:21:17 GMT
On Fri, Apr 3, 2009 at 2:01 PM, Paul Davis <paul.joseph.davis@gmail.com> wrote:
> Nope. There's nothing in CouchDB that allows for this yet. Different
> methods have been discussed for adding it via things like a value
> index to allow for users to selectively choose how things are sorted
> in the output but noone's stepped up with an implementation yet.
>

I think the simplest path would be to "print" the results of a
group=true or group_level query to a secondary database. Keeping it
incremental is the challenge.

> HTH,
> Paul Davis
>
> On Fri, Apr 3, 2009 at 4:57 PM, Nicolas Clairon <clairon@gmail.com> wrote:
>> Hi !
>>
>> I'm getting through a sorting issue with couchdb.
>>
>> Let's say we have a classic map/reduce for counting the number of
>> documents by type :
>>
>> function(doc){
>>  emit(doc.doc_type, 1);
>> }
>>
>> function(key, values){
>>   return sum(values);
>> }
>>
>> the results would be :
>>
>> type1 => 3
>> type2 => 1
>> type3 => 2
>> ...
>>
>> My question is simple : How can we sort the result by the compute reduce value ?
>> We can sort by key, but can we sort by value ?
>>
>> Regards,
>>
>> Nicolas
>>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message