Files
habitica/migrations/mystery_items.js
SabreCat dc3ee25e65 feat(content): subscriber items
Also fix(sprites): resize and recanvas gift boxes
2017-10-24 20:21:30 +00:00

39 lines
877 B
JavaScript

var _id = '';
var update = {
$addToSet: {
'purchased.plan.mysteryItems':{
$each:['armor_mystery_201710','head_mystery_201710']
}
}
};
/*var update = {
$set:{
'purchased.plan':{
customerId: "",
dateCreated: new Date(),
dateTerminated: null,
dateUpdated:new Date(),
gemsBought: 0,
mysteryItems: [],
paymentMethod: "Paypal",
planId : "basic_earned"
}
}
};*/
if (_id) {
// singular (missing items)
db.users.update({_id: _id}, update);
} else {
// multiple (once @ start of event)
db.users.update({
'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 });
}