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

x/mongoose/types/index.d.ts>mongoose.Schema#post

MongoDB object modeling designed to work in an asynchronous environment.
Go to Latest
method mongoose.Schema.prototype.post
import { mongoose } from "https://deno.land/x/mongoose@7.8.2/types/index.d.ts";
const { Schema } = mongoose;

Defines a post hook for the model.

Type Parameters

optional
T = Query<any, any>

Parameters

method: MongooseQueryMiddleware | MongooseQueryMiddleware[] | RegExp
options: SchemaPostOptions & { errorHandler: true; }
fn: ErrorHandlingMiddlewareWithOption<T>

Type Parameters

optional
T = THydratedDocumentType

Parameters

method: MongooseDocumentMiddleware | MongooseDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { errorHandler: true; }
fn: ErrorHandlingMiddlewareWithOption<T>

Type Parameters

T extends Aggregate<any>

Parameters

method: "aggregate" | RegExp
options: SchemaPostOptions & { errorHandler: true; }
fn: ErrorHandlingMiddlewareWithOption<T, Array<any>>

Type Parameters

optional
T = TModelType

Parameters

method: "insertMany" | RegExp
options: SchemaPostOptions & { errorHandler: true; }
fn: ErrorHandlingMiddlewareWithOption<T>

Type Parameters

optional
T = never

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: false; query: false; }
fn: PostMiddlewareFunction<never, never>

Type Parameters

optional
T = never

Parameters

method: MongooseDistinctQueryMiddleware | MongooseDistinctQueryMiddleware[]
options: SchemaPostOptions & { document: boolean; query: false; }
fn: PostMiddlewareFunction<T, QueryResultType<T>>

Type Parameters

optional
T = never

Parameters

method: MongooseDistinctDocumentMiddleware | MongooseDistinctDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: false; query: true; }
fn: PostMiddlewareFunction<T, T>

Type Parameters

optional
T = THydratedDocumentType

Parameters

method: MongooseDistinctDocumentMiddleware | MongooseDistinctDocumentMiddleware[]
fn: PostMiddlewareFunction<T, T>

Type Parameters

optional
T = THydratedDocumentType

Parameters

method: MongooseDistinctDocumentMiddleware | MongooseDistinctDocumentMiddleware[]
options: SchemaPostOptions & SchemaPostOptions
fn: PostMiddlewareFunction<T, T>

Type Parameters

optional
T = THydratedDocumentType

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: true; query: false; }
fn: PostMiddlewareFunction<T, T>

Type Parameters

optional
T = Query<any, any>

Parameters

method: MongooseRawResultQueryMiddleware | MongooseRawResultQueryMiddleware[]
fn: PostMiddlewareFunction<T, null | QueryResultType<T> | ModifyResult<QueryResultType<T>>>

Type Parameters

optional
T = Query<any, any>

Parameters

method: MongooseDefaultQueryMiddleware | MongooseDefaultQueryMiddleware[]
fn: PostMiddlewareFunction<T, QueryResultType<T>>

Type Parameters

optional
T = Query<any, any>

Parameters

method: MongooseDistinctQueryMiddleware | MongooseDistinctQueryMiddleware[]
options: SchemaPostOptions
fn: PostMiddlewareFunction<T, QueryResultType<T>>

Type Parameters

optional
T = Query<any, any>

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: false; query: true; }
fn: PostMiddlewareFunction<T, QueryResultType<T>>

Type Parameters

optional
T = THydratedDocumentType | Query<any, any>

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: true; query: true; }
fn: PostMiddlewareFunction<T, T | QueryResultType<T>>

Type Parameters

optional
T = THydratedDocumentType | Query<any, any>

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
fn: PostMiddlewareFunction<T, T | QueryResultType<T>>

Type Parameters

optional
T = never

Parameters

method: MongooseDistinctQueryMiddleware | MongooseDistinctQueryMiddleware[]
options: SchemaPostOptions & { document: boolean; query: false; }
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = never

Parameters

method: MongooseDistinctDocumentMiddleware | MongooseDistinctDocumentMiddleware[]
options: SchemaPostOptions & { document: false; query: boolean; }
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = never

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: false; query: false; }
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = THydratedDocumentType

Parameters

method: MongooseDistinctDocumentMiddleware | MongooseDistinctDocumentMiddleware[]
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = THydratedDocumentType

Parameters

method: MongooseDistinctDocumentMiddleware | MongooseDistinctDocumentMiddleware[]
options: SchemaPostOptions
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = THydratedDocumentType

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: true; query: false; }
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = Query<any, any>

Parameters

method: MongooseDefaultQueryMiddleware | MongooseDefaultQueryMiddleware[]
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = Query<any, any>

Parameters

method: MongooseDistinctQueryMiddleware | MongooseDistinctQueryMiddleware[]
options: SchemaPostOptions
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = Query<any, any>

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: false; query: true; }
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = THydratedDocumentType | Query<any, any>

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
options: SchemaPostOptions & { document: true; query: true; }
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = THydratedDocumentType | Query<any, any>

Parameters

method: MongooseQueryOrDocumentMiddleware | MongooseQueryOrDocumentMiddleware[] | RegExp
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

T extends Aggregate<any>

Parameters

method: "aggregate" | RegExp
fn: PostMiddlewareFunction<T, Array<AggregateExtract<T>>>

Type Parameters

T extends Aggregate<any>

Parameters

method: "aggregate" | RegExp
options: SchemaPostOptions
fn: PostMiddlewareFunction<T, Array<AggregateExtract<T>>>

Type Parameters

optional
T = TModelType

Parameters

method: "insertMany" | RegExp
fn: PostMiddlewareFunction<T, T>

Type Parameters

optional
T = TModelType

Parameters

method: "insertMany" | RegExp
options: SchemaPostOptions
fn: PostMiddlewareFunction<T, T>

Type Parameters

T extends Aggregate<any>

Parameters

method: "aggregate" | RegExp
fn: ErrorHandlingMiddlewareFunction<T, Array<any>>

Type Parameters

T extends Aggregate<any>

Parameters

method: "aggregate" | RegExp
options: SchemaPostOptions
fn: ErrorHandlingMiddlewareFunction<T, Array<any>>

Type Parameters

optional
T = TModelType

Parameters

method: "insertMany" | RegExp
fn: ErrorHandlingMiddlewareFunction<T>

Type Parameters

optional
T = TModelType

Parameters

method: "insertMany" | RegExp
options: SchemaPostOptions
fn: ErrorHandlingMiddlewareFunction<T>