Hi,
I’m evaluating Couchbase for a job, and experimenting with some things…
I’m trying to write a map/reduce that counts posts by day.
In the document, the created_date is specified in the ISO 8601 format.
(I’m assuming the libv8 that you are using has the ISO 8601 parse support?)
so, I wrote this in the map function…
function (doc, meta) {
if (doc.message, doc.created_time)
{
var postDate = Date.parse(doc.created_time);
var postDay = postDate.getDay();
emit(postDay, 1);
}
}
But, it doesn’t seem to execute…
The Date.parse() seems to work, as I can parse, and output the raw Date value.
However, as soon as I add the postDate.getDay() line, it craps out. I’m probably doing something stupid, but not exactly sure what.
Any ideas?
thanks!