Skip to content

Commit

Permalink
Re-open MongoDB connections
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamint08 committed May 29, 2024
1 parent 403a914 commit 54bcdca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/instances/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class Mongo {
console.log(chalk.bold.whiteBright(`MongoDB connected in `) + chalk.bold.greenBright(`${Date.now() - start}ms`));
this.isConnected = true;
});

this.client.on('close', async () => {
this.isConnected = false;
await this.connect(url);
});
}

async getCollection(db: string, col: string): Promise<any> {
Expand Down

0 comments on commit 54bcdca

Please sign in to comment.