Update MongoDB driver
This commit is contained in:
1 parent
00ccf99be6
commit
e3ef177842
5 files changed
+40
-39
No files matched your search
@@ -30,6 +30,7 @@ export async function connect(): Promise<void> {
|
||||
const MONGODB_CONNECTION_URL = "" + config.get("MONGODB_CONNECTION_URL");
|
||||
clientPromise = MongoClient.connect(MONGODB_CONNECTION_URL, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
});
|
||||
const db = (await clientPromise).db();
|
||||
mongoCollection = db.collection("cache");
|
||||
|
||||
@@ -50,6 +50,7 @@ export let client: MongoClient;
|
||||
export async function connect(): Promise<void> {
|
||||
clientPromise = MongoClient.connect("" + get("MONGODB_CONNECTION_URL"), {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
});
|
||||
|
||||
client = await clientPromise;
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ function getClient(): Promise<MongoClient> {
|
||||
const CONNECTION_URL = "" + config.get("MONGODB_CONNECTION_URL");
|
||||
MongoClient.connect(
|
||||
CONNECTION_URL,
|
||||
{ useNewUrlParser: true },
|
||||
{ useNewUrlParser: true, useUnifiedTopology: true },
|
||||
(err, client) => {
|
||||
if (err) return void reject(err);
|
||||
ensureIndexes(client);
|
||||
|
||||
Reference in new issue
Block a user