Functionplugin-mongoosev0.4.2Decorator
RegisterMongooseService
Registers a database service with a typed key.
Associates a service class with a key for dependency injection. The service becomes available via core.db.services[key].
The decorated class declares its schema as a public static schema member, which the plugin reads to build the model once the connection is open. A class without one is a compile error.
RegisterMongooseService<TService>(
key: TService,
options?: MongooseServiceRegistrationOptions
): <
Ctor extends Constructor<MongooseServices[TService]> & {
schema: mongoose.Schema;
}
>(
ctor: Ctor
) => voidTService
The service key type
TServiceThe service key type
key
key: TServiceService key for registration and type-safe access
options?
options?: MongooseServiceRegistrationOptionsAdditional registration options