Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.
The "View_collation" page has been changed by GabrielBirke.
The comment on this change is: Date converts to empty object.
http://wiki.apache.org/couchdb/View_collation?action=diff&rev1=12&rev2=13
--------------------------------------------------
It maybe be convenient to store date attributes in a human readable format (i.e. as a String),
but still sort by date. This can be done by converting the date to a number in the emit function.
For example, given a document with a created_at attribute of 'Wed Jul 23 16:29:21 +0100 2008',
the following emit function would sort by date
{{{
- emit(Date.parse(doc.created_at), doc);
+ emit(Date.parse(doc.created_at).getTime(), doc);
}}}
Alternatively, if you use a date format which sorts lexicographically, such as "2008/06/09
13:52:11 +0000" you can just