From 848d5fefeef3504efc97fdc2c31769ff2e7a439c Mon Sep 17 00:00:00 2001 From: Florian Bischoff Date: Tue, 10 Dec 2019 19:55:27 +0100 Subject: [PATCH] Mongoose: add session? to QueryFindOneAndUpdateOptions interface (#40937) * add session? to QueryFindOneAndUpdateOptions interface Needed to run findOneAndUpdate inside of a transaction * add session param to QueryFindOneAndRemoveOptions --- types/mongoose/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 751f50b2d5..15e10c390d 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -2280,6 +2280,8 @@ declare module "mongoose" { rawResult?: boolean; /** overwrites the schema's strict mode option for this update */ strict?: boolean|string; + /** use client session for transaction */ + session?: ClientSession; } interface QueryFindOneAndUpdateOptions extends QueryFindOneAndRemoveOptions { @@ -2310,6 +2312,7 @@ declare module "mongoose" { 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; + session?: ClientSession; } interface QueryUpdateOptions extends ModelUpdateOptions {