From 4105df8dcb825dd3d0ca048ca2bb09f9ada3d390 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 18 Aug 2021 11:47:28 +0200 Subject: :bug: fix findOneAndUpdate --- util/src/util/Database.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/src/util/Database.ts b/util/src/util/Database.ts index 2e04e0ff..ea517234 100644 --- a/util/src/util/Database.ts +++ b/util/src/util/Database.ts @@ -12,8 +12,12 @@ const connection = mongoose.createConnection(uri, { autoIndex: true, useNewUrlParser: true, useUnifiedTopology: true, - useFindAndModify: false, + useFindAndModify: true, }); + +// this will return the new updated document for findOneAndUpdate +mongoose.set("returnOriginal", false); // https://mongoosejs.com/docs/api/model.html#model_Model.findOneAndUpdate + console.log(`[Database] connect: mongodb://${url.username}@${url.host}${url.pathname}${url.search}`); connection.once("open", () => { console.log("[Database] connected"); -- cgit 1.4.1