From 8736cf6c90a026ff011778aba20ea24506d0f09b Mon Sep 17 00:00:00 2001 From: Luca Pizzini Date: Mon, 22 Aug 2022 14:58:47 +0200 Subject: [PATCH] Added findById type definitions Closes #12286 --- types/query.d.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/types/query.d.ts b/types/query.d.ts index d4fa5d1d9c8..33cafb634c1 100644 --- a/types/query.d.ts +++ b/types/query.d.ts @@ -368,6 +368,23 @@ declare module 'mongoose' { callback?: (err: CallbackError, doc: DocType | null, res: ModifyResult) => void ): QueryWithHelpers; + /** Declares the query a findById operation. When executed, the document with the given `_id` is passed to the callback. */ + findById( + id: mongodb.ObjectId | any, + projection?: ProjectionType | null, + options?: QueryOptions | null, + callback?: Callback + ): QueryWithHelpers; + findById( + id: mongodb.ObjectId | any, + projection?: ProjectionType | null, + callback?: Callback + ): QueryWithHelpers; + findById( + id: mongodb.ObjectId | any, + callback?: Callback + ): QueryWithHelpers; + /** Creates a `findByIdAndDelete` query, filtering by the given `_id`. */ findByIdAndDelete(id?: mongodb.ObjectId | any, options?: QueryOptions | null, callback?: (err: CallbackError, doc: DocType | null, res: any) => void): QueryWithHelpers;