Files
habitica/migrations/mystery_items.js
Sabe Jones 974896ce7b feat(events): April Mystery and Floral Potions (#7107)
* feat(events): April Mystery and Floral Potions
Also reorganizes the spritesmith folders for mounts so that head, body, and icon sprites are in separate folders.
2016-04-25 14:17:31 -05:00

39 lines
877 B
JavaScript

var _id = '';
var update = {
$addToSet: {
'purchased.plan.mysteryItems':{
$each:['head_mystery_201604','armor_mystery_201604']
}
}
};
/*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 });
}