import { CollectionName } from '../value-objects/collection-name.vo';
import { DatabaseName } from '../value-objects/database-name.vo';
import { DocumentEntity } from '../entities/document.entity';
import { CollectionEntity } from '../entities/collection.entity';
export interface IMongodbRepository {
find(
database: DatabaseName,
collection: CollectionName,
filter?: Record<string, any>,
projection?: Record<string, number>,
limit?: number,
sort?: Record<string, number>,
): Promise<DocumentEntity[]>;
insertOne(
database: DatabaseName,
collection: CollectionName,
document: Record<string, any>,
): Promise<DocumentEntity>;
insertMany(
database: DatabaseName,
collection: CollectionName,
documents: Record<string, any>[],
): Promise<DocumentEntity[]>;
updateMany(
database: DatabaseName,
collection: CollectionName,
filter: Record<string, any>,
update: Record<string, any>,
): Promise<number>;
deleteMany(
database: DatabaseName,
collection: CollectionName,
filter: Record<string, any>,
): Promise<number>;
count(
database: DatabaseName,
collection: CollectionName,
filter?: Record<string, any>,
): Promise<number>;
aggregate(
database: DatabaseName,
collection: CollectionName,
pipeline: any[],
): Promise<any[]>;
listCollections(database: DatabaseName): Promise<CollectionEntity[]>;
listIndexes(database: DatabaseName, collection: CollectionName): Promise<any[]>;
createIndex(
database: DatabaseName,
collection: CollectionName,
keys: Record<string, number>,
options?: Record<string, any>,
): Promise<string>;
}
export const MONGODB_REPOSITORY = Symbol('IMongodbRepository');