/** * Configuration options required to connect to a MongoDB database. * Encapsulates all necessary connection parameters to establish * a database connection within the application. */ export type DatabaseModuleOptions = { /** * The MongoDB connection URI string. * This typically includes the protocol, host, port, and authentication info. */ uri: string; /** * The name of the application using the database. * Used to identify the client application in MongoDB logs and monitoring. */ appName: string; /** * The specific database name within the MongoDB server to connect to. */ dbName: string; }; /** * Defines the shape of asynchronous options for configuring the database module. * Supports dynamic generation of DatabaseModuleOptions, allowing for * async configuration such as fetching from environment variables or remote config services. */ export type DatabaseModuleAsyncOptions = { /** * Factory function that returns the database connection options, * either synchronously or asynchronously. * Can accept injected dependencies as parameters. * * @param {...any[]} args - Injected dependencies used to build configuration * @returns {Promise | DatabaseModuleOptions} The database connection options */ useFactory: (...args: any[]) => Promise | DatabaseModuleOptions; /** * Optional list of providers to be injected into the useFactory function. */ inject?: any[]; };