import { Db, MongoClient } from 'mongodb'; import { LogFn } from '../common'; /** * Provides functionality for managing documents, collections in database. */ export declare class Database { /** * MongoDB database object */ db: Db; /** * MongoDB Client. */ client?: MongoClient; /** * Logger instance */ log: LogFn; /** * Constructs a new `Database` object. * * @param db MongoDB database object */ constructor(mongoClient: MongoClient, log?: LogFn); /** * Inserts documents into a given collection. * * @param documentsToInsert Array of documents, which are being imported * @param collectionName Collection name * @param collectionInsertOptions Optional collection import options */ insertDocumentsIntoCollection(documentsToInsert: any[], collectionName: string): Promise>; /** * Drops database. */ drop(): Promise; /** * Checks if a given collection exist. * * @param collectionName Collection name */ ifCollectionExist(collectionName: string): Promise; /** * Drops a given collection if exists. * * @param collectionName Collection name */ dropCollectionIfExists(collectionName: string): Promise; /** * Remove all documents from a given collection * if it exists. * * @param collectionName Collection name */ removeAllDocumentsIfCollectionExists(collectionName: string): Promise; /** * Closes connection with database. */ closeConnection(): Promise; }