rename with execution order, add desc & initial creation script

This commit is contained in:
otofune
2017-11-07 23:38:18 +09:00
parent 12d815dc42
commit 04dd2cb12b
8 changed files with 40 additions and 0 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);
});