1
0
Fork 1
mirror of https://example.com synced 2024-11-24 01:06:40 +09:00
firefish/tools/migration/shell.1487734995.user-profile.js

18 lines
318 B
JavaScript

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);
});