Skip to content

Commit 44f7e20

Browse files
committed
fix(mongo): update mongoose bindings
Signed-off-by: Jayne Doe <[email protected]>
1 parent a4c6511 commit 44f7e20

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/ts/db/handlers/mongo-connection-handler.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
Model,
44
Schema,
55
FilterQuery,
6-
Document, EnforceDocument,
6+
Document, HydratedDocument,
77
} from 'mongoose';
88
import {
99
createConnection,
@@ -27,7 +27,7 @@ export default class MongoConnectionHandler<T extends BasicDataItem> {
2727

2828
public async findById (
2929
model: Model<T>, id: string,
30-
): Promise<EnforceDocument<T, any, any> | null> {
30+
): Promise<HydratedDocument<T, any, any> | null> {
3131
try {
3232
return await model.findById(id);
3333
} catch (e: unknown) {
@@ -39,7 +39,6 @@ export default class MongoConnectionHandler<T extends BasicDataItem> {
3939
public async findOrCreate (model: Model<T>, id: string): Promise<T> {
4040
try {
4141
return await model.findOneAndUpdate(
42-
// @ts-expect-error Meddling with Mongo differences between spec and reality.
4342
{ '_id': id },
4443
{},
4544
{ upsert: true,
@@ -53,7 +52,6 @@ export default class MongoConnectionHandler<T extends BasicDataItem> {
5352

5453
public async deleteById (model: Model<T>, id: string): Promise<void> {
5554
try {
56-
// @ts-expect-error Meddling with Mongo differences between spec and reality.
5755
await model.deleteOne({ '_id': id });
5856
} catch (e: unknown) {
5957
logger.warn((e as Error).message);

0 commit comments

Comments
 (0)