summaryrefslogtreecommitdiff
path: root/tools/migration/user-profile.js
blob: e6666319e1982477dd2051ed011c0bee83427e80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);
});