Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface GtSchemaMetadataArgs

Hierarchy

Index

Properties

Properties

Optional id

id: boolean

Optional toJSON

toJSON: DocumentToObjectOptions

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.

link

https://mongoosejs.com/docs/4.x/docs/guide.html#toJSON

Optional toObject

toObject: DocumentToObjectOptions

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.

link

https://mongoosejs.com/docs/4.x/docs/guide.html#toObject

Generated using TypeDoc