UNPKG

multibridge

Version:

A multi-database connection framework with centralized configuration

34 lines (33 loc) 955 B
/** * Mongoose adapter for MultiBridge * Supports: MongoDB */ import { Connection, ConnectOptions } from "mongoose"; /** * Get or create a Mongoose connection for the current tenant * * @param options - Optional Mongoose connection options * @returns Mongoose connection instance configured for the current tenant * * @example * ```typescript * await runWithTenant(tenant, async () => { * const connection = await getMongooseConnection(); * const User = connection.model('User', userSchema); * await User.find(); * }); * ``` */ export declare function getMongooseConnection(options?: ConnectOptions): Promise<Connection>; /** * Close Mongoose connection for a specific tenant */ export declare function closeMongooseConnection(tenant?: { appid: string; orgid: string; appdbname: string; }): Promise<void>; /** * Close all Mongoose connections */ export declare function closeAllMongooseConnections(): Promise<void>;