File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- export * from "https://deno.land/x/web_bson@v0.2.5 /mod.ts " ;
1+ export * from "https://deno.land/x/web_bson@v0.3.0 /mod.js " ;
22export { crypto } from "https://deno.land/std@0.154.0/crypto/mod.ts" ;
33export { BufReader } from "https://deno.land/std@0.154.0/io/mod.ts" ;
44export { writeAll } from "https://deno.land/std@0.154.0/streams/conversion.ts" ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { FindCursor } from "./commands/find.ts";
2727import { ListIndexesCursor } from "./commands/list_indexes.ts" ;
2828import { update } from "./commands/update.ts" ;
2929
30- export class Collection < T > {
30+ export class Collection < T extends Document > {
3131 #protocol: WireProtocol ;
3232 #dbName: string ;
3333
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export class Database {
3838 } ) ;
3939 }
4040
41- collection < T = Document > ( name : string ) : Collection < T > {
41+ collection < T extends Document = Document > ( name : string ) : Collection < T > {
4242 return new Collection < T > ( this . #cluster. protocol , this . name , name ) ;
4343 }
4444
@@ -88,7 +88,7 @@ export class Database {
8888 *
8989 * https://www.mongodb.com/docs/manual/reference/command/create/#mongodb-dbcommand-dbcmd.create
9090 */
91- async createCollection < T > (
91+ async createCollection < T extends Document > (
9292 name : string ,
9393 options ?: CreateCollectionOptions ,
9494 ) : Promise < Collection < T > > {
Original file line number Diff line number Diff line change 11import { Collection } from "../collection/collection.ts" ;
22import { Chunk , File } from "../types/gridfs.ts" ;
33import { IndexOptions } from "../types.ts" ;
4+ import { Document } from "../../deps.ts" ;
45
5- async function ensureIndex < T > (
6+ async function ensureIndex < T extends Document > (
67 index : IndexOptions ,
78 collection : Collection < T > ,
89) : Promise < ReturnType < Collection < T > [ "createIndexes" ] > > {
Original file line number Diff line number Diff line change @@ -794,7 +794,7 @@ type Flatten<T> = T extends Array<infer Item> ? Item : T;
794794
795795type IsAny < T , Y , N > = 0 extends ( 1 & T ) ? Y : N ;
796796
797- export type InsertDocument < TDocument extends { _id ?: ObjectId } > =
797+ export type InsertDocument < TDocument extends Document > =
798798 & Omit < TDocument , "_id" >
799799 & {
800800 _id ?: TDocument [ "_id" ] | ObjectId ;
You can’t perform that action at this time.
0 commit comments