1 | import { ModuleMetadata, Type } from '@nestjs/common';
|
2 | import { ConnectOptions, MongooseError, Connection } from 'mongoose';
|
3 | export interface MongooseModuleOptions extends ConnectOptions {
|
4 | uri?: string;
|
5 | retryAttempts?: number;
|
6 | retryDelay?: number;
|
7 | connectionName?: string;
|
8 | connectionFactory?: (connection: any, name: string) => any;
|
9 | connectionErrorFactory?: (error: MongooseError) => MongooseError;
|
10 | lazyConnection?: boolean;
|
11 | onConnectionCreate?: (connection: Connection) => void;
|
12 | }
|
13 | export interface MongooseOptionsFactory {
|
14 | createMongooseOptions(): Promise<MongooseModuleOptions> | MongooseModuleOptions;
|
15 | }
|
16 | export type MongooseModuleFactoryOptions = Omit<MongooseModuleOptions, 'connectionName'>;
|
17 | export interface MongooseModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
18 | connectionName?: string;
|
19 | useExisting?: Type<MongooseOptionsFactory>;
|
20 | useClass?: Type<MongooseOptionsFactory>;
|
21 | useFactory?: (...args: any[]) => Promise<MongooseModuleFactoryOptions> | MongooseModuleFactoryOptions;
|
22 | inject?: any[];
|
23 | }
|