Skip to main content

goosetyped.gttoobject

Home > @pebula/goosetyped > GtToObject

GtToObject() function

A decorator for toObject 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 toObject. 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\#toObject

Signature:

export declare function GtToObject(config?: Omit<mongoose.ToObjectOptions, 'transform'>): MethodDecoratorOf<[any, any]>;

Parameters

Parameter

Type

Description

config

Omit<mongoose.ToObjectOptions, 'transform'>

(Optional)

Returns:

MethodDecoratorOf<[any, any]>