import { Model } from "https://deno.land/x/model@v1.2/src/main.ts";
Constructors
new
Model(collectionName: string,
conn: { client: MongoClient; database: Database; },
PopulateOptions?: PopulateOptions,
new
Model(collectionName: string,
conn: { client: MongoClient; database: string; },
PopulateOptions?: PopulateOptions,
new
Model(collectionName: string,
conn: { ConnectionOptions: ConnectOptions; },
PopulateOptions?: PopulateOptions,
new
Model(collectionName: string,
conn: { ConnectionOptions: ConnectOptions; database: string; },
PopulateOptions?: PopulateOptions,
new
Model(collectionName: string,
conn: string | MongoClient | { client?: MongoClient; database?: Database | string; ConnectionOptions?: ConnectOptions; },
PopulateOptions?: PopulateOptions,
Type Parameters
optional
populateSchema extends PopulateSchema = Record<never, never>Properties
private
optional
PopulateOptions: PopulateOptionsreadonly
client: MongoClientMethods
connect(unnamed 0: { connection: string | ConnectOptions; database?: string; }): Promise<void>
count(filter: Filter<Schema>, options?: CountOptions)
delete(filter?: Filter<Schema>, options?: FindOptions & { multiple?: true; }): Promise<ObjectId[]>
delete(filter?: Filter<Schema>, options?: FindOptions & { multiple?: false; }): Promise<ObjectId | unknown>
getModel(): Promise<Collection<Schema>>
insert(document: InsertDocument<Schema>, InsertOptions?: InsertOptions): Promise<ObjectId>
insert(document: InsertDocument<Schema>[], InsertOptions?: InsertOptions): Promise<ObjectId[]>
select<projection extends ProjectionType<Schema> | unknown, multiple extends boolean | unknown, populate extends >(filter?: Filter<Schema>, options?: Omit<FindOptions, "projection"> & { multiple?: multiple; populate?: populate; projection?: projection; }): Promise<SelectResult<projection, Schema, populateSchema, populate, multiple>>
| true
| string
| string[]
| unknown