You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/08/17 03:33:54 UTC
[GitHub] wonderfuljamesjin opened a new issue #755: Age time calculate results are not updated in the couchdb view
wonderfuljamesjin opened a new issue #755: Age time calculate results are not updated in the couchdb view
URL: https://github.com/apache/couchdb/issues/755
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, please help figure out the issue, thanks a lot
```
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);
}
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services