I need calculate the time age days based on the couchdb document : doc.lastupdate with current day, I defined the couchdb map view as following, I did not know why the results not update/refresh everyday? like the doc.lastupdate =2017-08-16 23:15:1, but today it still see the results as 0 age day? only after I change the view and save it, the result can be taken effect as expected, I know there is a setting in couched stale=update_after, but it is not working
function(doc) {
if (doc.type) {
new_date = doc.lastupdate;
var date_arr = new_date.split(" ");
var date_aar2 = date_arr[0];
date_aar2 = new Date(date_aar2.replace(/-/g, "/"));
date_aar1 = new Date();
var days = date_aar1.getTime() - date_aar2.getTime();
var age = parseInt(days / (1000 * 60 * 60 * 24));
emit(date_aar2,age);
}
}
Hi
I need calculate the time age days based on the couchdb document : doc.lastupdate with current day, I defined the couchdb map view as following, I did not know why the results not update/refresh everyday? like the doc.lastupdate =2017-08-16 23:15:1, but today it still see the results as 0 age day? only after I change the view and save it, the result can be taken effect as expected, I know there is a setting in couched stale=update_after, but it is not working