Merge pull request #1654 from HabitRPG/paglias/remove-deleted-tags
Migration to remove deleted tags from tasks
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
_.each(db.users.find(), function(user){
|
||||
var tags = user.tags;
|
||||
|
||||
_.each(user.tasks, function(task){
|
||||
_.each(task.tags, function(val, key){
|
||||
_.each(tags, function(tag){
|
||||
if(key == tag.id) delete task.tags[key];
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
try {
|
||||
db.users.update({_id:user._id}, user);
|
||||
} catch(e) {
|
||||
print(e);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user