incubator-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:44:06 GMT
Thanks Aurélien,

> One consequence is that you won't get timestamps from 2012-12-02.

OK so if I understand you correctly if I'm only querying using the date part e.g. "2012-12-02"
then it will work OK? 

Also, is there a better way to do this that overcomes this issue?

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