Query epoch time diff for the past week

Hi,
I have document stored like this:
{
“first”: {
“customer”: {
“maxMonthlyPageVisit”: 250000,
“name”: “CUS1”,
“password”: “pass”,
“username”: “user”
},
“fileLastUpdated”: 1594100450652,
“periodicLastUpdated”: 1594007131744,
“type”: “customer”
}
}

i want to write an n1ql query to monitor weather the field “periodicLastUpdated” has been changed this past week.
been trying out the date functions without success.
would love some help.

Thanks.

SELECT *
FROM default AS d
WHERE d.type = "customer" 
     AND (d.periodicLastUpdated) >=  (NOW_MILLIS() - 7*24*60*60*1000));
1 Like