From f2c5dc468c9bdb86e096565e9306f53eb1876ce0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 22 Feb 2017 12:43:15 +0900 Subject: Extract user's profile --- tools/migration/user-profile.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tools/migration/user-profile.js (limited to 'tools') diff --git a/tools/migration/user-profile.js b/tools/migration/user-profile.js new file mode 100644 index 0000000000..e6666319e1 --- /dev/null +++ b/tools/migration/user-profile.js @@ -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); +}); -- cgit v1.2.3-freya