2013-06-03 23:15:48 +00:00
|
|
|
//mongo habitrpg ./node_modules/lodash/lodash.js migrations/20130602_survey_rewards.js
|
|
|
|
|
|
2017-03-01 16:10:48 +00:00
|
|
|
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
|
|
|
|
|
// We've now upgraded to lodash v4 but the code used in this migration has not been
|
|
|
|
|
// adapted to work with it. Before this migration is used again any lodash method should
|
|
|
|
|
// be checked for compatibility against the v4 changelog and changed if necessary.
|
|
|
|
|
// https://github.com/lodash/lodash/wiki/Changelog#v400
|
|
|
|
|
|
2013-06-04 14:32:33 +00:00
|
|
|
var members = []
|
2013-06-03 23:15:48 +00:00
|
|
|
members = _.uniq(members);
|
|
|
|
|
|
2013-06-04 14:32:33 +00:00
|
|
|
var query = {
|
2013-06-03 23:15:48 +00:00
|
|
|
_id: {$exists:1},
|
|
|
|
|
$or:[
|
|
|
|
|
{_id: {$in: members}},
|
2013-06-04 14:32:33 +00:00
|
|
|
//{'profile.name': {$in: members}},
|
2013-06-03 23:15:48 +00:00
|
|
|
{'auth.facebook.name': {$in: members}},
|
|
|
|
|
{'auth.local.username': {$in: members}},
|
|
|
|
|
{'auth.local.email': {$in: members}}
|
|
|
|
|
]
|
2013-06-04 14:32:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
print(db.users.count(query));
|
|
|
|
|
|
|
|
|
|
db.users.update(query,
|
|
|
|
|
{
|
|
|
|
|
$set: { 'achievements.helpedHabit': true },
|
|
|
|
|
$inc: { balance: 2.5 }
|
|
|
|
|
},
|
|
|
|
|
{multi:true}
|
|
|
|
|
)
|