From f1607b08ca84d5cf06b099c9cf2629213d760c5b Mon Sep 17 00:00:00 2001 From: Oguzhan Date: Mon, 28 Oct 2024 18:11:42 +0300 Subject: [PATCH] types: added toJSON:flattenObjectIds effect --- types/document.d.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/types/document.d.ts b/types/document.d.ts index 0d263ce1dd..e52169dfca 100644 --- a/types/document.d.ts +++ b/types/document.d.ts @@ -256,10 +256,17 @@ declare module 'mongoose' { set(value: string | Record): this; /** The return value of this method is used in calls to JSON.stringify(doc). */ - toJSON(options?: ToObjectOptions & { flattenMaps?: true }): FlattenMaps>; + toJSON(options?: ToObjectOptions & { flattenMaps?: true, flattenObjectIds?: false }): FlattenMaps>; + toJSON(options: ToObjectOptions & { flattenObjectIds: false }): FlattenMaps>; + toJSON(options: ToObjectOptions & { flattenObjectIds: true }): ObjectIdToString>>; toJSON(options: ToObjectOptions & { flattenMaps: false }): Require_id; - toJSON>(options?: ToObjectOptions & { flattenMaps?: true }): FlattenMaps; + toJSON(options: ToObjectOptions & { flattenMaps: false; flattenObjectIds: true }): ObjectIdToString>; + + toJSON>(options?: ToObjectOptions & { flattenMaps?: true, flattenObjectIds?: false }): FlattenMaps; + toJSON>(options: ToObjectOptions & { flattenObjectIds: false }): FlattenMaps; + toJSON>(options: ToObjectOptions & { flattenObjectIds: true }): ObjectIdToString>; toJSON>(options: ToObjectOptions & { flattenMaps: false }): T; + toJSON>(options: ToObjectOptions & { flattenMaps: false; flattenObjectIds: true }): ObjectIdToString; /** Converts this document into a plain-old JavaScript object ([POJO](https://masteringjs.io/tutorials/fundamentals/pojo)). */ toObject(options?: ToObjectOptions): Require_id;