update type overloads

This commit is contained in:
Erik 2023-08-16 03:20:45 +03:00
parent eb08105404
commit c7e60eef48
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68

View File

@ -1,5 +1,5 @@
import { inspect } from 'node:util'; import { inspect } from 'node:util';
import { MongoClient, MongoClientOptions, Db, Document, WithId, ObjectId, Filter, IndexSpecification, CreateIndexesOptions, FindOptions } from 'mongodb'; import { MongoClient, MongoClientOptions, Db, Document, WithId, ObjectId, Filter, IndexSpecification, CreateIndexesOptions, FindOptions, ModifyResult } from 'mongodb';
import { IServer, ILogger, LoggerClientOptions } from './interfaces/index.js'; import { IServer, ILogger, LoggerClientOptions } from './interfaces/index.js';
type Credentials = { type Credentials = {
@ -300,7 +300,9 @@ class MongoDB
return result; return result;
} }
async findOneAndDelete<T extends Document> (db: string, filter: Document, meta = false) async findOneAndDelete<T extends Document> (db: string, filter: Document, meta: false): Promise<WithId<T>>
async findOneAndDelete<T extends Document> (db: string, filter: Document, meta: true): Promise<ModifyResult<T>>
async findOneAndDelete<T extends Document> (db: string, filter: Document, meta = false)
{ {
if (!this.#db) if (!this.#db)
throw new Error('MongoDB not connected'); throw new Error('MongoDB not connected');