import { Db, Collection, ObjectId, Filter, UpdateFilter, ClientSession, BulkWriteResult, AnyBulkWriteOperation, BulkWriteOptions, AggregateOptions, Abortable, AggregationCursor, CountDocumentsOptions, DeleteOptions, FindOneAndUpdateOptions, FindOptions, FindOneOptions, InsertOneOptions } from 'mongodb'; import { Collection as UCollection } from '../Collection'; interface Document { _id?: ObjectId; [key: string]: any; } export declare abstract class MongoBaseRepository { protected db: Db; protected collectionName: string; protected readonly session?: ClientSession; constructor(db: Db, collectionName: string, session?: ClientSession); protected get collection(): Collection; forCollection(collectionName: string): MongoBaseRepository; /** * Create a new document in the collection * @param doc object to be created {} * @returns doc with a _id: ObjectId */ create(doc: Omit, options?: InsertOneOptions): Promise; createMany(inputs: any[], options?: BulkWriteOptions): Promise; createMany(inputs: UCollection, options?: BulkWriteOptions): Promise | null>; /** * Find an item by its _id in the collection * @param id ObjectId | string * @returns {} | null */ findById(id: ObjectId | string, options?: Omit & Abortable): Promise; /** * Find the first item that match the filter in the collection * Use the options to further configuration * @param filter * @param options * @returns doc with _id: ObjectId or null */ findOne(filter: Filter, options?: Omit & Abortable): Promise; /** * Return an array of items that match the filter object * @param filter * @param options * @returns T[] */ findAll(filter?: Filter, options?: FindOptions & Abortable): Promise; update(filter: Filter, updates: UpdateFilter, options?: FindOneAndUpdateOptions): Promise; updateById(id: ObjectId | string, updates: UpdateFilter, options?: FindOneAndUpdateOptions): Promise; deleteById(id: ObjectId | string, options?: DeleteOptions): Promise; deleteAll(filter?: Filter, options?: DeleteOptions): Promise; count(filter?: Filter, options?: CountDocumentsOptions & Abortable): Promise; bulkWrite(operations: AnyBulkWriteOperation[], options?: BulkWriteOptions): Promise; aggregate(pipeline?: Document[], options?: AggregateOptions & Abortable): AggregationCursor; } export {}; //# sourceMappingURL=MongoBaseRepository.d.ts.map