UNPKG

monguito

Version:

MongoDB Abstract Repository implementation for Node.js

25 lines (24 loc) 1.39 kB
import { Connection, UpdateQuery } from 'mongoose'; import { MongooseRepository } from './mongoose.repository'; import { PartialEntityWithId } from './repository'; import { TransactionalRepository } from './transactional-repository'; import { DomainModel } from './util/domain-model'; import { Entity } from './util/entity'; import { DeleteAllOptions, SaveAllOptions, SaveOptions } from './util/operation-options'; /** * Abstract Mongoose-based implementation of the {@link TransactionalRepository} interface. */ export declare abstract class MongooseTransactionalRepository<T extends Entity & UpdateQuery<T>> extends MongooseRepository<T> implements TransactionalRepository<T> { /** * Sets up the underlying configuration to enable database operation execution. * @param {DomainModel<T>} domainModel the domain model supported by this repository. * @param {Connection} connection (optional) a MongoDB instance connection. */ protected constructor(domainModel: DomainModel<T>, connection?: Connection); /** @inheritdoc */ saveAll<S extends T>(entities: (S | PartialEntityWithId<S>)[], options?: SaveAllOptions): Promise<S[]>; /** @inheritdoc */ deleteAll<S extends T>(options?: DeleteAllOptions<S>): Promise<number>; /** @inheritdoc */ protected update<S extends T>(entity: PartialEntityWithId<S>, options?: SaveOptions): Promise<S>; }