Skip to content

Commit 5cecb9f

Browse files
authored
Merge pull request #14 from mattljiang/mongoose-reopen-connection
Mongoose Server Connection Bugfix
2 parents b580e82 + 71349a6 commit 5cecb9f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

electron/databases/mongo.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { MongoError } from 'mongodb';
44
// Mongoose connection wrapped in function that takes the index of the selected database as the parameter. This index is used to target the correct database for querying.
55
const connectMongoose = async (i: number, URI: string) => {
66
try {
7+
await mongoose.connection.close();
78
const db = await mongoose.connect(
89
URI,
910
{ useNewUrlParser: true, useUnifiedTopology: true }

0 commit comments

Comments
 (0)