Skip to content

Commit

Permalink
fix: Fixed typeorm mongodb health check fails with mongodb>=5.0 (#2399)
Browse files Browse the repository at this point in the history
  • Loading branch information
supaflyENJOY authored Nov 26, 2023
1 parent 050ebe5 commit b6026c2
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/health-indicator/database/typeorm.health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,10 @@ export class TypeOrmHealthIndicator extends HealthIndicator {
? connection.options.url
: driver.buildConnectionUrl(connection.options),
driver.buildConnectionOptions(connection.options),
(err: Error, client: any) => {
if (err) {
return reject(new MongoConnectionError(err.message));
}
client.close(() => resolve());
},
);
)
.catch((err: Error) => reject(new MongoConnectionError(err.message)))
.then((client: TypeOrm.MongoClient) => client.close().catch(() => {}))
.then(() => resolve());
});
}

Expand Down

0 comments on commit b6026c2

Please sign in to comment.