dateToArray(date) milliseconds

Hi,

Using builtin functions instead of custom functions is better, as I read in the doc.

Now the builtin function dateToArray doesn’t include the milliseconds, so what do you suggest if I want the milliseconds to be included in my view for sorting?

Example in doc:
http://www.couchbase.com/docs//couchbase-manual-2.0/couchbase-views-writing-utilityfuncs.html

Your help will be appreciated

Fred

Since the Milliseconds are independent from other date parsing I would go for grabbing them off the parsed date separately and append them to the array. Something like this:

function (doc, meta) { if(doc.type === "datetest") { var dateArray = dateToArray(doc.date); var ms = new Date(doc.date).getMilliseconds(); dateArray.push(ms);
emit(dateArray, meta.id);

}
}

This keeps all the other elements consistent with the way dateToArray handles them but appends the Milliseconds as needed.