-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8636fce
commit 4f4e75a
Showing
6 changed files
with
144 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import { Collection as MongoCollection, type Document } from 'mongodb'; | ||
import type { PongoDb } from '../main'; | ||
import { | ||
Collection as MongoCollection, | ||
ObjectId, | ||
type Document, | ||
} from 'mongodb'; | ||
import type { DocumentHandler, PongoDb } from '../main'; | ||
import { Collection } from './mongoCollection'; | ||
|
||
export class Db { | ||
constructor(private pongoDb: PongoDb) {} | ||
|
||
collection<T extends Document>(collectionName: string): MongoCollection<T> { | ||
collection<T extends Document>( | ||
collectionName: string, | ||
): MongoCollection<T> & { | ||
handle(id: ObjectId, handle: DocumentHandler<T>): Promise<T | null>; | ||
} { | ||
return new Collection<T>(this.pongoDb.collection<T>(collectionName)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters