Redacted view
A typical data security requirement is to expose views of data to users, omitting specific sensitive records and fields. For instance, a personnel database might hide salary details while showing employee names. Due to a confidentiality clause, the system may even need to omit some employees from query results entirely. In this example, you will discover how to build an aggregation pipeline to apply such filtering rules for a view.
Scenario
You have a user management system containing data about various people in a database, and you need to ensure a particular client application cannot view the sensitive parts of the data relating to each person.
Consequently, you will provide a read-only view of each person's data. You will use the view, named adults, to redact personal data and expose this view to the client application as the only way it can access personal information. The view will apply the following two rules to restrict data access:
- Only...