couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carl Bourne <carl.bou...@me.com>
Subject Re: Sorting dates in CouchDB
Date Mon, 08 Oct 2012 09:58:04 GMT
Aurélien,

> You can do that, but be aware that you're comparing strings of different lengths.
> One consequence is that you won't get timestamps from 2012-12-02.


I just checked some of my data and all of the stored strings are of the same length. Am I
understanding you correctly here? e.g.

"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-04T22:19:00+00:00"
"expire":"2012-10-05T23:13:00+00:00"
"expire":"2012-10-05T23:13:00+00:00"
"expire":"2012-10-05T23:13:00+00:00"
"expire":"2012-10-05T23:13:00+00:00"
"expire":"2012-10-05T23:13:00+00:00"
"expire":"2012-10-05T23:13:00+00:00"
"expire":"2012-10-06T00:01:00+00:00"
"expire":"2012-10-06T00:01:00+00:00"
"expire":"2012-10-06T00:01:00+00:00"
"expire":"2012-10-06T00:01:00+00:00"
"expire":"2012-10-06T00:01:00+00:00"
"expire":"2012-10-06T00:01:00+00:00"
"expire":"2012-10-06T00:07:00+00:00"
"expire":"2012-10-06T00:07:00+00:00"
"expire":"2012-10-06T00:07:00+00:00"

Regards, 

Carl

On 8 Oct 2012, at 10:35, Aurélien Bénel <aurelien.benel@utt.fr> wrote:

>> have a bunch of documents stored in Couch with expiry dates like this: "expire":
"2020-07-28T15:13:00+00:00"
>> (...)
>> I'm then querying the data ranges like this: ?startkey="2012-10-02"&endkey="2012-12-02"
> 
> You can do that, but be aware that you're comparing strings of different lengths.
> One consequence is that you won't get timestamps from 2012-12-02.
> 
> This is because of the following alphabetical order:
> 2012-10-01T8:00:00+00:00
> 2012-10-02
> 2012-10-02T9:00:00+00:00
> 2012-12-01T10:00:00+00:00
> 2012-12-02
> 2012-12-02T11:00:00+00:00
> 
> 
> Regards,
> 
> Aurélien
> 
> 


Mime
View raw message