Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/mongoose/types/index.d.ts>mongoose.model

MongoDB object modeling designed to work in an asynchronous environment.
Latest
function mongoose.model
import { mongoose } from "https://deno.land/x/mongoose@6.13.4/types/index.d.ts";
const { model } = mongoose;

Type Parameters

optional
TSchema extends Schema = any

Parameters

name: string
optional
schema: TSchema
optional
collection: string
optional
options: CompileModelOptions

Returns

Model<InferSchemaType<TSchema>, ObtainSchemaGeneric<TSchema, "TQueryHelpers">, ObtainSchemaGeneric<TSchema, "TInstanceMethods">, ObtainSchemaGeneric<TSchema, "TVirtuals">, TSchema> & ObtainSchemaGeneric<TSchema, "TStaticMethods">

Parameters

name: string
optional
schema: Schema<T, any, any> | Schema<T & Document, any, any>
optional
collection: string
optional
options: CompileModelOptions

Returns

Model<T>

Type Parameters

T
U
optional
TQueryHelpers = { }

Parameters

name: string
optional
schema: Schema<T, any, any, TQueryHelpers, any, any>
optional
collection: string
optional
options: CompileModelOptions