couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Samuel Newson <>
Subject Re: question about "complex" range queries
Date Thu, 03 Apr 2014 14:16:49 GMT
You *can* rely on the order of rows with identical keys to be in _id order as that’s the
tie-breaking field.

Other cases where this apparent consideration of value in the sort order is when views are
clustered (ala BigCouch).

Sorting a view by value requires chained map-reduce, presently only on the proprietary Cloudant
platform, but something CouchDB should deliver after the Rcouch merge.


On 3 Apr 2014, at 15:04, Jens Alfke <> wrote:

> On Apr 3, 2014, at 5:53 AM, Scott Weber <> wrote:
>> Are you saying that it is NOT something that should be relied on?
> Bob Newson just said that pretty emphatically.
> If you want your index to be sorted in a particular way, then emit keys that sort that
way! Don’t try to find some undocumented hack that lets you get away without emitting properly
ordered keys.
>> I also notice that the documents are sent into the view already sorted by their _id.
 Is that a behavior that CAN be replied on?
> Definitely not. And a properly written map function shouldn’t care anyway — if your
map function uses any sort of external state that could distinguish the order in which docs
are passed to it, then You’re Doing It Wrong.
> —Jens

View raw message