Closed proswdev closed 6 years ago
Good catch. Leaving a few comments on the commit.
Please make the style changes and remove the comment. Or let me know if I should do it after the merge.
Hmm, what if the value in the transform was actually undefined
could that be the case? Should we really be checking if the initial transform has that key or not?
@proswdev thanks for the contribution. I publish the changes as version 1.5.1
@all-contributors add @proswdev for bug, test, code
@mblarsen
I've put up a pull request to add @proswdev! :tada:
Version 1.5 is not compatible with 1.4. It erroneously adds properties with undefined value for paths not present in original transformed object.
Example: with schema where fields are optional { field1: Number, field2: String, field3: String}) document before transform { field1: 123, field3: 'abc' } becomes after transform by mongoose-hidden { field1: 123, field2: undefined, field3: 'abc' }
The pull request includes a fix for this