Mask sensitive fields
Data masking, or data obfuscation, is a technique that allows an organization to alter sensitive data, maintaining its structure but removing the actual sensitive content. This ensures developers and testers can work with realistic datasets without risking data misuse and allowing the organization to protect sensitive information. In this example, we will discover how to use a pipeline to mask the fields of a document.
Note
This example requires MongoDB version 4.4 or above. This is because you'll be using the $rand
operator introduced in version 4.4.
Scenario
You want to perform irreversible masking on the sensitive fields in a collection of credit card payments, ready to provide the output dataset to a third party for analysis, without exposing sensitive information to that third party.
The specific changes that you need to make to the payment fields include the following:
- Partially obfuscate the cardholder's name
- Obfuscate...