couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Clairon <clai...@gmail.com>
Subject sorting by reduce value
Date Fri, 03 Apr 2009 20:57:17 GMT
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

Mime
View raw message