wheresvic / mongoose-field-encryption

A simple symmetric encryption plugin for individual fields. Dependency free, only mongoose peer dependency.
MIT License
74 stars 32 forks source link

.lean() with post-hook of .find and .findOne #65

Open doguhanokumus opened 3 years ago

doguhanokumus commented 3 years ago

Hi again 😊

I also had to use .lean functionality in our business as we have over 250 queries running throughout our projects and it would take much more time to replace them all.

So I've added the workaround I came up with, mapping after the document(s) are returned with the post hook for find and findOne.

This seems to be working fine with our tests, I hope you can have time to verify and merge soon.

Doguhan

wheresvic commented 3 years ago

Hi @doguhanokumus

This looks good but we definitely need a few tests to verify that the feature works as expected. If you can add them, I'd be happy to merge.

Thanks,