A type helper that strips away all members of the mongoose Document instance from the type as well as all methods.
example
exportclass Message extends GtModel() {
id: string;
text: string;
myMethod(): void { }
}
const msg = new Message(); // Not the msg instance has a lot of members from the Document type (The instance of Model)const m: StripDoColumns<Message>; // now m has only "text" but not "id"// Since "id" also exists in Document, to include it we need to exclude it from the strip.const m: StripDoColumns<Message, 'id'>; // now m has "id" & "text"```
A type helper that strips away all members of the mongoose Document instance from the type
example
exportclass Message extends GtModel() {
id: string;
text: string;
myMethod(): void { }
}
const msg = new Message(); // Not the msg instance has a lot of members from the Document type (The instance of Model)const m: StripDoc<Message>; // now m has only "myMethod" & "text" but not "id"// Since "id" also exists in Document, to include it we need to exclude it from the strip.const m: StripDoc<Message, 'id'>; // now m has "id", "myMethod" & "text"```
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.
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.
A type helper that strips away all members of the mongoose Document instance from the type as well as all methods.
export class Message extends GtModel() { id: string; text: string; myMethod(): void { } } const msg = new Message(); // Not the msg instance has a lot of members from the Document type (The instance of Model) const m: StripDoColumns<Message>; // now m has only "text" but not "id" // Since "id" also exists in Document, to include it we need to exclude it from the strip. const m: StripDoColumns<Message, 'id'>; // now m has "id" & "text" ```