fix mongo script

This commit is contained in:
Thibault Duplessis 2019-05-10 05:10:02 +07:00
parent 963af08f12
commit 25daf2e87f

View file

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