From 6d85a30ecac8d72d269b6f7643c5a57fd2eee0fa Mon Sep 17 00:00:00 2001 From: Chathu Vishwaijith <4evercreations@gmail.com> Date: Wed, 25 Sep 2019 04:39:29 +0530 Subject: [PATCH] Add omitUndefined to QueryFindOneAndUpdateOptions #36437 (#38115) --- types/mongoose/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 191a90549a..c14b5641c4 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -30,6 +30,7 @@ // Boris Figovsky // Simon Driscoll // Anton Kenikh +// Chathu Vishwajith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -2276,6 +2277,10 @@ declare module "mongoose" { multipleCastError?: boolean; /** Field selection. Equivalent to .select(fields).findOneAndUpdate() */ fields?: any | string; + /** If true, delete any properties whose value is undefined when casting an update. In other words, + if this is set, Mongoose will delete baz from the update in Model.updateOne({}, { foo: 'bar', baz: undefined }) + before sending the update to the server.**/ + omitUndefined?: boolean; } interface QueryUpdateOptions extends ModelUpdateOptions {