try-catch createIndex
This commit is contained in:
parent
6e85e46412
commit
2b4f190264
@ -409,7 +409,14 @@ class MongoDB
|
|||||||
if (existing)
|
if (existing)
|
||||||
await this.#db.collection(collection).dropIndex(existing.name);
|
await this.#db.collection(collection).dropIndex(existing.name);
|
||||||
|
|
||||||
await this.#db.collection(collection).createIndex(index, options);
|
try
|
||||||
|
{
|
||||||
|
await this.#db.collection(collection).createIndex(index, options);
|
||||||
|
}
|
||||||
|
catch (err)
|
||||||
|
{
|
||||||
|
this.#logger.error(err as Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async ensureIndices (collection: string, indices: IndexSpecification[], options?: CreateIndexesOptions & StringIndexable): Promise<void>
|
async ensureIndices (collection: string, indices: IndexSpecification[], options?: CreateIndexesOptions & StringIndexable): Promise<void>
|
||||||
|
Loading…
Reference in New Issue
Block a user