MongoDB OptionalId<xxx>

This commit is contained in:
k8w 2022-01-12 15:37:53 +08:00
parent 57f0129fde
commit 3f4082593e

View File

@ -1,4 +1,4 @@
import { Collection, Db, MongoClient } from "mongodb";
import { Collection, Db, MongoClient, OptionalId } from "mongodb";
import { Logger } from "tsrpc";
import { DbPost } from "../shared/db/DbPost";
import { BackConfig } from "./BackConfig";
@ -14,7 +14,7 @@ export class Global {
this.db = client.db();
}
static collection<T extends keyof DbCollectionType>(col: T): Collection<DbCollectionType[T]> {
static collection<T extends keyof DbCollectionType>(col: T): Collection<OptionalId<DbCollectionType[T]>> {
return this.db.collection(col);
}