Exactly the same as the toObject option but only applies when the documents toJSON method is called.
If you want to apply a transformation consider overriding the toJSON method instead of implementing a transformer function.
Call the super method and apply changed to the returned value, this is much better then using an out of context transformer.
If you insist on a transformer, consider using the @GtToJSON() decorator with a dedicated method.
In any case, favor using mixins to allow reuse of your code.
Documents have a toObject method which converts the mongoose document into a plain javascript object. This method accepts a few options. Instead of applying these options on a per-document basis we may declare the options here and have it applied to all of this schemas documents by default.
If you want to apply a transformation consider overriding the toObject method instead of implementing a transformer function.
Call the super method and apply changed to the returned value, this is much better then using an out of context transformer.
If you insist on a transformer, consider using the @GtToObject() decorator with a dedicated method.
In any case, favor using mixins to allow reuse of your code.
Generated using TypeDoc
See @link https://mongoosejs.com/docs/guide.html#id