couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: how to do it in couchDB
Date Tue, 10 Jun 2008 15:59:17 GMT
On Tue, Jun 10, 2008 at 12:24 AM, Ryszard Szopa <> wrote:
> The most natural way of solving this problem would be to first have a
> view with a map emitting users and their scores, keyed by user_id, and
> a reduce that groups a user and his results in one object, and *then*
> run a query on this, mapping teams-names to lists of results and
> reduce it to get the mean. Unfortunately, I have no idea if something
> like this is possible in CouchDB.

I'm planning to add some functionality to CouchRest, which will
automatically take the results of a group=true reduce query, page
through them, adding all the key/value pairs as documents in another

I plan to call the functionality Remap - hopefully I'll have it
written sometime this week.

Writing additional queries as map/reduce views on the derived dataset
would give you a lot of flexibility. For instance, writing maps across
the Remap set would allow you to sort by group reduce value, making it
easy to query on the popularity of certain items in the set - or total
and average scores for a team, in your case.

The only problem is that the second dataset won't automatically be
kept up to date by CouchDB, and the nature of views makes it hard to
refresh the derived dataset in any other way than by regenerating the
whole thing (paging through the reduce set again.)


Chris Anderson

View raw message