paricafe/tools/migration/user-profile.js

19 lines
318 B
JavaScript
Raw Normal View History

2017-02-21 21:43:15 -06:00
db.users.find({}).forEach(function(user) {
print(user._id);
db.users.update({ _id: user._id }, {
$rename: {
bio: 'description'
},
$unset: {
location: '',
birthday: ''
},
$set: {
profile: {
location: user.location || null,
birthday: user.birthday || null
}
}
}, false, false);
});