mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 05:07:22 +01:00
29 lines
604 B
JavaScript
29 lines
604 B
JavaScript
// mongo habitrpg ./node_modules/underscore/underscore.js ./migrations/20130307_normalize_algo_values.js
|
|
|
|
/**
|
|
* Remove duff histories for dailies
|
|
*/
|
|
db.users.find().forEach(function(user){
|
|
|
|
|
|
_.each(user.tasks, function(task, key){
|
|
// remove task history
|
|
if (task.type === "daily") {
|
|
task.history = []
|
|
}
|
|
});
|
|
|
|
try {
|
|
db.users.update(
|
|
{_id:user._id},
|
|
{$set:
|
|
{
|
|
'tasks' : user.tasks
|
|
}
|
|
},
|
|
{multi:true}
|
|
);
|
|
} catch(e) {
|
|
print(e);
|
|
}
|
|
}) |