mblarsen / mongoose-hidden

A Mongoose schema plugin for filtering properties you usually do not want to sent client-side like passwords and IDs.
MIT License
89 stars 19 forks source link

Core issue with programmatically using `schema.options.toObject.transform` or `schema.options.toJSON.transform` #98

Closed niftylettuce closed 4 years ago

niftylettuce commented 4 years ago

Right now you can't simply do this:

schema.options.toObject.transform({
  foo: 'bar',
  baz: 'foo'
});

(e.g. foo should be hidden if we had { hidden: { foo: true } } on the toObject.

This would be great to have as it would solve https://github.com/mblarsen/mongoose-hidden/issues/58.