UNPKG

naga-audit-service

Version:

A comprehensive audit service library for NestJS applications with MongoDB support

53 lines 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MongoRepository = void 0; class MongoRepository { constructor(repository) { this._repository = repository; } async findOne(filters, projections, options) { const result = await this._repository.findOne(filters, projections, options).lean(); return result; } async find(filters, projections, options) { const result = await this._repository.find(filters, projections, options).lean(); return result; } async findOneAndUpdate(filters, updateQuery, options) { const result = await this._repository.findOneAndUpdate(filters, updateQuery, options).lean(); return result; } async findOneAndDelete(filters, options) { const result = await this._repository.findOneAndDelete(filters, options).lean(); return result; } updateMany(filters, updateQuery) { return this._repository.updateMany(filters, updateQuery); } async countDocuments(filters, options) { return this._repository.countDocuments(filters, options); } async create(payload) { const instance = new this._repository(payload); const savedInstance = await instance.save(); return savedInstance.toJSON(); } async aggregate(pipeline, options) { return this._repository.aggregate(pipeline, options); } bulkWrite(operations) { return this._repository.bulkWrite(operations); } async distinct(field, filters) { return this._repository.distinct(field, filters); } async deleteMany(operation) { return this._repository.deleteMany(operation); } async insertMany(payload) { const result = await this._repository.insertMany(payload); return result; } } exports.MongoRepository = MongoRepository; //# sourceMappingURL=repository.js.map