Changed Mongo query to check DateTerminated to prevent accumulation of mystery items when subscription is ended.

This commit is contained in:
kylestratis 2015-10-25 18:16:42 -04:00
parent bcc522f08d
commit b75f044d07

View file

@ -27,6 +27,6 @@ if (_id) {
db.users.update({_id:_id}, update);
} else {
// multiple (once @ start of event)
db.users.update({'purchased.plan.customerId':{$ne:null}}, update, {multi:true});
db.users.update({$and: [{'purchased.plan.customerId':{$ne:null}},{$or: [{'purchased.plan.dateTerminated':{$gte:new Date()}},{'purchased.plan.dateTerminated':{$eq:null}}]}]}, update, {multi:true});
}