Bug - pretty much the same as #36 but with a broader scope.
What is the current behavior?
applyGetters assumes that an array will always be returned and attempts to map the returned value. We have some string arrays which return non-arrays in certain situations, and it worked with 0.4.0.
TypeError: Cannot read properties of undefined (reading 'map')
at /mongoose-test/node_modules/mongoose-lean-getters/index.js:130:67
...
If the current behavior is a bug, please provide the steps to reproduce.
Do you want to request a feature or report a bug?
Bug - pretty much the same as #36 but with a broader scope.
What is the current behavior?
applyGetters
assumes that an array will always be returned and attempts tomap
the returned value. We have some string arrays which return non-arrays in certain situations, and it worked with 0.4.0.If the current behavior is a bug, please provide the steps to reproduce.
Here's the offending schema definition:
What is the expected behavior?
The above should not throw an error.
What are the versions of Node.js, mongoose-lean-getters, and Mongoose are you are using? Note that "latest" is not a version.
Node: 20.12.2 mongoose-lean-getters: 1.1.0 and 2.1.0 mongoose: 7.7.0 and 8.5.0