couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: multiple keys and sorting
Date Mon, 17 Nov 2008 15:26:44 GMT
On Sun, Nov 16, 2008 at 7:54 PM, Nicholas Retallack
<> wrote:
> We could do 3 queries anyway, each with the maximum number of documents on
> the page, then sort them ourselves and throw away the extras.  This gets
> messy fast though, when you try to keep track of where to start the second
> page in each query.
> What would you guys suggest?

I think the smart money would be in working this way, with keys like
["joe", "2008-11-1"] and running 3 queries. You're right about the
tough part being paginating the subsequent pages, because you don't
know where to start with each one until they've been merged and

Unless you can come up with a collation key that does the work
magically ("dude_groups") any kind of multi-range extension to couch
would have the same problems your application is facing. This is the
type of thing that belongs in a library, I think.

An interesting place to put the library might be as an _external
action, if you really want to keep it out of the client, but external
_actions have the dubious distinction of using server resources to do
what could be equally well done on the client. (Also they are not yet
in CouchDB trunk.)


Chris Anderson

View raw message