summary refs log tree commit diff
path: root/util
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-18 11:47:28 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-18 11:47:28 +0200
commit9ab8fc8e6e454bef6b99122709084484f5d01e1c (patch)
treede43e451015f6e9d52ff7a9ca77ee070601ee781 /util
parentfix #199 (diff)
downloadserver-9ab8fc8e6e454bef6b99122709084484f5d01e1c.tar.xz
:bug: fix findOneAndUpdate
Diffstat (limited to 'util')
-rw-r--r--util/src/util/Database.ts6
1 files changed, 5 insertions, 1 deletions
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");