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.
Go to Latest
function mongoose.model
import { mongoose } from "https://deno.land/x/mongoose@8.6.3/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">, HydratedDocument<InferSchemaType<TSchema>, ObtainSchemaGeneric<TSchema, "TVirtuals"> & ObtainSchemaGeneric<TSchema, "TInstanceMethods">, ObtainSchemaGeneric<TSchema, "TQueryHelpers">>, 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, any>
optional
collection: string
optional
options: CompileModelOptions