From be3fe8f1f45f3682ec8cd428739d43a1fa9edc0f Mon Sep 17 00:00:00 2001 From: kylestratis Date: Sat, 31 Oct 2015 22:08:16 -0400 Subject: [PATCH] Added check for existence of dateTerminated field --- migrations/mystery_items.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/migrations/mystery_items.js b/migrations/mystery_items.js index 9a7b37eec4..611544f294 100644 --- a/migrations/mystery_items.js +++ b/migrations/mystery_items.js @@ -27,6 +27,9 @@ if (_id) { db.users.update({_id:_id}, update); } else { // multiple (once @ start of event) - db.users.update({$and: [{'purchased.plan.customerId':{$ne:null}},{$or: [{'purchased.plan.dateTerminated':{$gte:new Date()}},{'purchased.plan.dateTerminated':{$eq:null}}]}]}, update, {multi:true}); -} - + db.users.update([{$and: [{'purchased.plan.customerId':{$ne:null}}, + {$or: [{'purchased.plan.dateTerminated':{$gte:new Date()}}, + {'purchased.plan.dateTerminated':{$exists:false}}, + {'purchased.plan.dateTerminated':{$eq:null}}]}]}], update, {multi:true}); + }); +} \ No newline at end of file