goosetyped.gttojson
Home > @pebula/goosetyped > GtToJSON
GtToJSON() function
A decorator for toJSON
with a prototype bound implementation for the transform
function.
Note that it recommended to avoid using a transform function (through schema options) or a transform method through this decorator and instead apply a transformation by overriding the toJSON
. Call the super method and apply changed to the returned value, this is much better then using an out of context transformer.
https://mongoosejs.com/docs/4.x/docs/guide.html\#toJSON
Signature:
export declare function GtToJSON(config?: Omit<mongoose.ToObjectOptions, 'transform'>): MethodDecoratorOf<[any, any]>;
Parameters
Parameter | Type | Description |
---|---|---|
config | Omit<mongoose.ToObjectOptions, 'transform'> | (Optional) |
Returns:
MethodDecoratorOf<[any, any]>