I am trying to create a couchbase view which retrieve the IDs of all the views that haven't been updated for more than one month. They also should not have the string ID in their key:
function (doc, meta) {
if (meta.id.indexOf("ID") == -1) {
var currentDate = new Date();
var currentDateInMillis = currentDate.getTime();
if (doc.lastTimestampMillis != null && doc.lastTimestampMillis < (currentDateInMillis - (30 * 24 * 60 * 60 * 1000))) {
emit(meta.id, meta.id)
}
}
}
Notice that I have lastTimestampMillis field in my document.
Well, This code doesn't work.