mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-20 02:34:12 +00:00
fix(newMessages): ad migration
This commit is contained in:
parent
24833de3a7
commit
9d2723b418
1 changed files with 13 additions and 0 deletions
13
migrations/20140803_remove_undefined_notifications.js
Normal file
13
migrations/20140803_remove_undefined_notifications.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
var _ = require('lodash');
|
||||
|
||||
db.users.find({}).forEach(function(user){
|
||||
var newNewMessages = {};
|
||||
|
||||
_.each(user.newMessages, function(val, key){
|
||||
if(key != "undefined"){
|
||||
newNewMessages[key] = val;
|
||||
};
|
||||
});
|
||||
|
||||
db.users.update({_id: user._id}, {$set: {'newMessages': newNewMessages}});
|
||||
});
|
||||
Loading…
Reference in a new issue