summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-22 12:43:15 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-22 12:43:15 +0900
commitf2c5dc468c9bdb86e096565e9306f53eb1876ce0 (patch)
tree375cc71cb5d538541f8c9db8b80a615556a4d233 /tools
parentClean up :sparkles: (diff)
downloadsharkey-f2c5dc468c9bdb86e096565e9306f53eb1876ce0.tar.gz
sharkey-f2c5dc468c9bdb86e096565e9306f53eb1876ce0.tar.bz2
sharkey-f2c5dc468c9bdb86e096565e9306f53eb1876ce0.zip
Extract user's profile
Diffstat (limited to 'tools')
-rw-r--r--tools/migration/user-profile.js18
1 files changed, 18 insertions, 0 deletions
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);
+});