Last active
October 11, 2018 08:33
-
-
Save NicolasGeraud/b8ef6e081ce954d4bd7f1454d4856724 to your computer and use it in GitHub Desktop.
anonymize user emails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.users.find().forEach( | |
function(user) { | |
if (user.email) { | |
var newEmail = user.email + '.anon' | |
print(user.email + " => " + newEmail); | |
db.users.updateOne( | |
{ _id: user._id }, | |
{ $set:{ 'email': newEmail } }, | |
{ upsert: false }); | |
} | |
}); | |
db.genericnotificationconfigs.find({'notifier': 'default-email'}).forEach( | |
function(notif) { | |
var newEmail = notif.config + '.anon' | |
print(notif.config + " => " + newEmail); | |
db.genericnotificationconfigs.updateOne( | |
{ _id: notif._id }, | |
{ $set:{ 'config': newEmail } }, | |
{ upsert: false }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment