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

Ability to skip encrypting fields with null value #96

Closed
adidaslevy opened this issue Jun 5, 2023 · 0 comments
Closed

Ability to skip encrypting fields with null value #96

adidaslevy opened this issue Jun 5, 2023 · 0 comments

Comments

@adidaslevy
Copy link
Contributor

I have encountered an issue that fields with null value are disappearing from document.
That is - the encryptFields function tries to encrypt null fields as if they are objects.

Additionally, encrypting null value generates a large string, which eventually wastes disk space.

See example of encrypted nulls:


"__enc_contactPerson" : true,
"__enc_contactPerson_d" : "31323334353637383930313233343536:fc52ec69cbf7d3c7ec8843605fb792fc", 
"__enc_name" : true,
"__enc_organization" : true,
"__enc_organization_d" : "31323334353637383930313233343536:fc52ec69cbf7d3c7ec8843605fb792fc" 
"__v" : 0,
"title" : null,
"__enc_birthDate" : true,
"__enc_birthDate_d" : "31323334353637383930313233343536:fc52ec69cbf7d3c7ec8843605fb792fc", 
"__enc_firstName" : true,
"__enc_formattedName" : true,
"__enc_lastName" : true,
"__enc_middleName" : true,
"__enc_middleName_d" : "",
"__enc_referenceID" : true,
"middleName": "31323334353637383930313233343536:ab45883e5f44441ed4a3ff5795fabd5935722aa9fb05e55a4af889efabe73f43"

where instead the document can be much cleaner:


"contactPerson" : null, 
"organization" : null 
"__v" : 0,
"title" : null,
"birthDate" : null, 
...

This Breaks the requirement of an encrypted field to be mandatory in a document on one hand, but on the other hand gives you much more flexibility.

Similarly to last time, I have created a fix with a test.

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

1 participant