Hi Carl,
If I were storing dates, then I'd favour storing them as unix dates (which are long integers), not strings; not least because it's more efficient, but also because you leave the door open to doing something more interesting with the dates down the track without having to parse them to/from strings first. That said, I think your start key should find the first 2012-10-02 successfully, but your end-key would only find up to 2012-12-01T23:59:59 (note that's 1 Dec, not 2 Dec), because there is no expiry date exactly matching just 2012-12-02. Since your query returned no rows at all, maybe the endkey is failing entirely; not sure why that would be.
Cheers,
Kai

On 08/10/2012 11:21, Carl Bourne wrote:
Hi I just wanted to sanity check what I'm doing here.

I have a bunch of documents stored in Couch with expiry dates like this: "expire": 
"2020-07-28T15:13:00+00:00"

I have a simple map function defined like this:

function(doc) {
emit(doc.expire);
}

I'm then querying the data ranges like this: 
?startkey="2012-10-02"&endkey="2012-12-02"

Is this the correct way to do this type of thing?

Regards,

Carl


Reply via email to