Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB question : is it possible to anonymise a field in a sub-document #65

Open
sylguyot opened this issue May 29, 2018 · 1 comment

Comments

@sylguyot
Copy link

sample of my json document:
{
"_id" : ObjectId("5ac34319dc0ef65f31755b60"),
...,
identity : {
"givenName" : [
"Nicolas"
],
"sn" : [
"GUYOT"
],
...
}
}

I have tried to anonymise identity.givenName with the code:

anonymize('identity.givenName').using FieldStrategy::AnonymizeArray.new(FieldStrategy::RandomFirstName.new)

no errors are thrown but it doesn't change the field value ...

@sylguyot sylguyot changed the title MongoDB question : is possible to anonymise a field in a sub-document MongoDB question : is it possible to anonymise a field in a sub-document May 29, 2018
@sunitparekh
Copy link
Owner

example subdocument anonymization:
in case subdocument is array use:
https://github.com/sunitparekh/data-anonymization/blob/master/examples/mongodb_whitelist_dsl.rb#L34

in case of subdocument as hash use:
https://github.com/sunitparekh/data-anonymization/blob/master/examples/mongodb_whitelist_dsl.rb#L38

sample JSON document for above is:
https://github.com/sunitparekh/data-anonymization/blob/master/sample-data/mongo/plans.json

let me know this solves your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants