I’m using couchdb as downloaded from http://couch.io/get on Mac OS X 10.6, and it does not handle Dates properly. For example, the following view (map only) gives emits {} for date objects:
function(doc) {
emit(new Date(), null);
}
The same thing holds for variations on the date: Date("2000-10-10"), Date("2000/10/10"), and Date("10/10/2000") all produce {}.
My guess is that this has to do with my javascript version, since Dates work as I’d expect on my Linux machine. Still, when I run js from the command line, it has a completely different behavior for Dates. If this is a version issue, then how can I tell what version of javascript CouchDB is running, how can I change that, and what version should I be running?
My guess is that for some reason the date’s
toString()doesn’t get called, so it is getting{}as a generic representation of a javascript object.Not sure of the result you were expecting, but you could use one of these: