From 4d2262f3490788566a6919a00d45b9f85854253e Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 22 Nov 2024 21:17:07 +0000 Subject: [PATCH] Re-patch db connection Signed-off-by: Fred Boniface --- src/services/dbAccess.services.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/dbAccess.services.js b/src/services/dbAccess.services.js index 507d3e0..dca668b 100644 --- a/src/services/dbAccess.services.js +++ b/src/services/dbAccess.services.js @@ -5,11 +5,15 @@ const dbPass = process.env.OWL_DB_PASS || "twittwoo"; const dbName = process.env.OWL_DB_NAME || "owlboard"; const dbPort = process.env.OWL_DB_PORT || 27017; const dbHost = process.env.OWL_DB_HOST || "localhost"; -const uri = `mongodb://${dbUser}:${dbPass}@${dbHost}:${dbPort}/?authSource=owlboard`; +const uri = `mongodb://${dbUser}:${dbPass}@${dbHost}:${dbPort}`; +const connOpts = { + useUnifiedTopology: true, + authSource: "owlboard", +} const { MongoClient } = require("mongodb"); -const client = new MongoClient(uri); +const client = new MongoClient(uri, connOpts); const db = client.db(dbName); async function query(collection, query, returnId = false) {