From 1c2d602646014fb876b7af4d756ee6c3e857bd99 Mon Sep 17 00:00:00 2001 From: IICarst <67209089+IICarst@users.noreply.github.com> Date: Tue, 12 Mar 2024 15:12:01 +0100 Subject: [PATCH] Added pre and post function types on Query class --- types/query.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/query.d.ts b/types/query.d.ts index d67e11200ff..0161bba2b2f 100644 --- a/types/query.d.ts +++ b/types/query.d.ts @@ -627,6 +627,12 @@ declare module 'mongoose' { QueryOp >; + /** Add pre middleware to this query instance. Doesn't affect other queries. */ + pre(fn: Function): this; + + /** Add post middleware to this query instance. Doesn't affect other queries. */ + post(fn: Function): this; + /** Get/set the current projection (AKA fields). Pass `null` to remove the current projection. */ projection(fields?: ProjectionFields | string): ProjectionFields; projection(fields: null): null;