Extract user's profile
This commit is contained in:
18
tools/migration/user-profile.js
Normal file
18
tools/migration/user-profile.js
Normal 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);
|
||||
});
|
Reference in New Issue
Block a user