docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Build a NestJS feature module that exposes tenant-aware models backed by MongoDB. The module must register schemas as injectable models on both the default connection and a named connection, and support asynchronous schema registration driven by configuration.
register registers a Book schema on the default database connection and exposes a provider that can create and read book documents with title, author, and optional tags fields. @testanalyticsUri when registering sets up an Audit schema on a separate connection named analytics, and the audit model records entries without writing to the default connection collections. @testregisterAsync with a factory that awaits config values builds a FeatureFlag schema with a configurable collection name suffix and registers it as an injectable model. @testBook and Audit models in their own providers without redefining schemas. @testexport interface CatalogModuleOptions {
analyticsUri?: string;
flagCollectionSuffix?: string;
}
export interface CatalogAsyncOptions {
inject?: any[];
useFactory?: (...args: any[]) => Promise<CatalogModuleOptions> | CatalogModuleOptions;
}
export class CatalogModule {
static register(options: CatalogModuleOptions): DynamicModule;
static registerAsync(options: CatalogAsyncOptions): DynamicModule;
}Provides NestJS integration utilities for defining schemas and exposing injectable models bound to MongoDB connections.