Extract user's profile

This commit is contained in:
syuilo
2017-02-22 12:43:15 +09:00
parent ce216d218b
commit f2c5dc468c
10 changed files with 102 additions and 69 deletions

View File

@ -0,0 +1,18 @@
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);
});