import { EventEmitter } from 'node:events'; import { MongoClient, Collection, Db, Document } from 'mongodb'; import type { MongoConnectionContract } from '../types/database.js'; import type { MongoDBConnectionConfig } from '../define_config.js'; /** * MongoDB connection class manages a given database connection. * It uses the official MongoDB driver to establish and manage connections. */ export declare class MongoConnection extends EventEmitter implements MongoConnectionContract { name: string; private config; private logger; /** * MongoDB client instance */ client: MongoClient; /** * MongoDB database instance */ db: Db; /** * Connection state */ state: 'registered' | 'open' | 'closed'; private _isReady; private _isClosed; constructor(name: string, config: MongoDBConnectionConfig, logger: any); /** * Returns a boolean indicating if the connection is ready for making * database queries. */ get isReady(): boolean; /** * Returns a boolean indicating if the connection is closed. */ get isClosed(): boolean; /** * Get a collection from the database */ collection(name: string): Collection; /** * Build the MongoDB connection URI from the config */ private buildConnectionUri; /** * Connect to the MongoDB server */ connect(): Promise; /** * Disconnect from the MongoDB server */ disconnect(): Promise; }