Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface GtDocumentMetadataArgs

Hierarchy

Index

Properties

Optional autoCreate

autoCreate: boolean

Optional autoIndex

autoIndex: boolean

Optional bufferCommands

bufferCommands: boolean

Optional capped

capped: boolean | number | { autoIndexId?: boolean; max?: number; size?: number }

Optional collation

collation: CollationDocument

Optional collection

collection: string

The collection name in the database Optional: When not set, induced from model name

Optional connectionId

connectionId: string

The connection id to use when registering the model. If a connection id is not defined (default behavior) then the model is registered using the default connection.

Use addConnection to add a new connection to the connection pool available for models.

If at the time of creating the model the connection does not exists, it will "wait" for the connection to be added.

Optional id

id: boolean

Optional minimize

minimize: boolean

Optional skipInit

skipInit: boolean

Whether to skip initialization Optional: When not set, default's to false

Note that this refer to the skipInit from mongoose.

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