2014-05-06 16:13:33 +00:00
|
|
|
var _id = '';
|
|
|
|
|
var update = {
|
2015-05-23 10:03:36 +00:00
|
|
|
$addToSet: {
|
2014-05-06 16:13:33 +00:00
|
|
|
'purchased.plan.mysteryItems':{
|
2015-09-23 19:23:42 +00:00
|
|
|
$each:['head_mystery_201509','armor_mystery_201509']
|
2014-05-06 16:13:33 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2014-06-12 18:32:20 +00:00
|
|
|
/*var update = {
|
|
|
|
|
$set:{
|
|
|
|
|
'purchased.plan':{
|
|
|
|
|
customerId: "",
|
|
|
|
|
dateCreated: new Date(),
|
|
|
|
|
dateTerminated: null,
|
|
|
|
|
dateUpdated:new Date(),
|
|
|
|
|
gemsBought: 0,
|
|
|
|
|
mysteryItems: [],
|
|
|
|
|
paymentMethod: "Paypal",
|
|
|
|
|
planId : "basic_earned"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};*/
|
|
|
|
|
|
2014-05-06 16:13:33 +00:00
|
|
|
if (_id) {
|
|
|
|
|
// singular (missing items)
|
|
|
|
|
db.users.update({_id:_id}, update);
|
|
|
|
|
} else {
|
|
|
|
|
// multiple (once @ start of event)
|
2015-11-01 02:08:16 +00:00
|
|
|
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});
|
|
|
|
|
});
|
|
|
|
|
}
|