Functionpluginsv0.6.1Decorator
RegisterMongoModel
Associates a Mongoose model with a database service
Creates a Mongoose model from the decorated static schema property and stores it for service registration. The model becomes available as this.modelthis.model in the service. Must be applied to a public static schemapublic static schema property in the service class.
RegisterMongoModel<TService>(
collection: TService
): <
SchemaObj extends Record<KeyOfSchema, mongoose.Schema>,
KeyOfSchema extends keyof SchemaObj & (string | symbol)
>(
target: SchemaObj,
propertyKey: KeyOfSchema
) => voidRegisterMongoModel<TService>(
collection: TService
): <
SchemaObj extends Record<KeyOfSchema, mongoose.Schema>,
KeyOfSchema extends keyof SchemaObj & (string | symbol)
>(
target: SchemaObj,
propertyKey: KeyOfSchema
) => voidTService
The service key type
TServiceTServiceThe service key type
collection
collection: TServicecollection: TServiceCollection name for the Mongoose model