incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Weber <>
Subject Re: question about "complex" range queries
Date Thu, 03 Apr 2014 19:32:46 GMT
Thank you for being so kind, while you were putting statements into my text and then telling
me that I am wrong.

I never said what I was relying on.  I was trying to determine if this was a known behavior
becuase it does not seem to appear in any of the no less than four different sites that purport
to have documentation (any single one of which is not comprehensive).

I have specifically *not* relied on it because to date, none of the documentation I can find
says it is expected behavior. I have coded my own way to solve it, or have found creative
ways to use the keys which are documented behavior. And yet the sorted value behavior is there,
yielding unexpected results that I had been spending time investigating.

My question was asking if it can be relied upon, and should be in the documentation (or perhaps
was in yet another site I hadn't stumbled across yet), or if it is not intended, and therefore
could stop occurring now or in the future.

As you say it's an artifact, so we won't attempt to take advantage of it.  I just thought
that if the system was using CPU cycles to intentionally sort that far into the string, and
it was known and reliable, we could not waste code and CPU doing it again.


 From: Jens Alfke <>
To:; Scott Weber <> 
Sent: Thursday, April 3, 2014 9:04 AM
Subject: Re: question about "complex" range queries

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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message