mongo index specification type

This commit is contained in:
Erik 2023-04-30 22:34:47 +03:00
parent 687494727b
commit 3f9cdc2d69
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68

View File

@ -1,5 +1,5 @@
import { inspect } from "node:util";
import { MongoClient, MongoClientOptions, Db, Document, WithId, ObjectId, Filter } from "mongodb";
import { MongoClient, MongoClientOptions, Db, Document, WithId, ObjectId, Filter, IndexSpecification } from "mongodb";
import { IServer, ILogger, LoggerClientOptions } from "./interfaces/index.js";
type Credentials = {
@ -327,7 +327,7 @@ class MongoDB {
return this.#db.collection(coll);
}
async ensureIndex (collection: string, indices: string[] = []) {
async ensureIndex (collection: string, indices: IndexSpecification = []) {
if (!this.#db)
throw new Error(`MongoDB not connected`);
if (!(indices instanceof Array))