patron since mongodb script

This commit is contained in:
Thibault Duplessis 2019-05-10 05:05:15 +07:00
parent cfd36365d5
commit 963af08f12

View file

@ -0,0 +1,9 @@
var u = 'neio';
var since = new Date('2019-01-17');
function monthDiff(dateFrom, dateTo) {
return dateTo.getMonth() - dateFrom.getMonth() +
(12 * (dateTo.getFullYear() - dateFrom.getFullYear()))
}
db.user4.update({_id: u}, {$set: { 'plan.months': monthDiff(since, new Date()) + 1, 'plan.since': since}});