couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: CouchDB: Display 3 rows with the highest value
Date Tue, 30 Jul 2013 16:41:43 GMT
I'll note, one time only, that you asked this same question in
#couchdb IRC room but did not engage with the help you were receiving.

Views are ordered by their key, their full key, and nothing but their
key. So you can't perform the query you are after. Namely, sorting by
value.

B.


On 30 July 2013 16:49, Hank Knight <hknight555@gmail.com> wrote:
> This returns 3 rows:
> https://zurv3aqzm.iriscouch.com/fruit/_design/zzz6/_view/zzz6?limit=3&group=true
>
> I want to display the 3 rows with the highest value, not any arbitrary 3 rows.
>
> Here is my code:
>
> /// Map Function ///
> function(doc) {
>   if (doc.fruit) emit(doc.fruit, null);
> }
>
> /// Reduce Function ///
> _count
>
> /// Grouping: True ///

Mime
View raw message