couchdb-user mailing list archives

On Thu, Oct 2, 2008 at 1:00 PM, Jeremy Wall <jwall@google.com> wrote:
> sure you can:
>
> function(keys, values) {
> var sorted = sort(values);
> return [values[0], values[1], values[2], values[3], values[4]];
> }
>
> the above really really simplistic reduce demonstrates that you can return
> sorted subsets of a value for a given key.
>
The above reduce isn't "proper" although there's a chance it could work.
Reduce functions should be composed with the group=false (and no
startkey/endkey) use case in mind. This function would likely produce
gibberish on such a query.
The demand for a query that works like this is high, so we may
implement one someday, but the fact of the matter is that this is the
same as querying the map view 20 times, as mentioned in my previous
email - only in this case it would be done on the server, saving some
IPC costs.
--
Chris Anderson
http://jchris.mfdz.com