MongoDB OptionalId<xxx>
This commit is contained in:
parent
57f0129fde
commit
3f4082593e
@ -1,4 +1,4 @@
|
|||||||
import { Collection, Db, MongoClient } from "mongodb";
|
import { Collection, Db, MongoClient, OptionalId } from "mongodb";
|
||||||
import { Logger } from "tsrpc";
|
import { Logger } from "tsrpc";
|
||||||
import { DbPost } from "../shared/db/DbPost";
|
import { DbPost } from "../shared/db/DbPost";
|
||||||
import { BackConfig } from "./BackConfig";
|
import { BackConfig } from "./BackConfig";
|
||||||
@ -14,7 +14,7 @@ export class Global {
|
|||||||
this.db = client.db();
|
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);
|
return this.db.collection(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user