3

I need to send a copy of my MongoDB to Sitecore Support for investigation. For security reasons I want all sensitive data to be anonymized.

Fields I'm talking about are: FirstName, LastName, Addresses and Email addresses.

Is there an easy and fast way to do this?

My Contacts collection contains around 350.000 entries.

2
  • Have you taken a look at github.com/sunitparekh/data-anonymization to see if this will work for your needs? Looks like a Ruby project that specializes in data-anonymization and has MongoDB support/example. I haven't used this before, so I can't comment on how well it works Commented Sep 13, 2017 at 19:17
  • That looks like a good long term solution. Now I just want a quick way to do it. I've tested Dmytro's answer and it works.
    – Koen Heye
    Commented Sep 13, 2017 at 20:12

1 Answer 1

3

You can mass-replace personal data right from the MongoDB console:

var i = 0;
db.Contacts.find({}, {_id: 1}).forEach(function(contact) {
  db.Contacts.update({_id: contact._id}, {$set: {
    "Personal.FirstName": "RandomFirstName" + i,
    "Personal.Surname": "RandomSurname" + i
    /* etc. for other personal data */
  }});
  i++;
})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.