Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
3.3.2
-
Not using Mongoose. Not transpiling the driver.
Description
Using the Node Driver, I create a connection with the "useUnifiedTopology" option set to true with a snippet like this.
const { url } = databaseConfig; |
const databaseConnection = new MongoClient(url, { |
useUnifiedTopology: true, |
useNewUrlParser: true, |
});
|
return databaseConnection.connect(); |
Later I close the connection and check to see if it's closed:
await client.close();
|
expect(client.isConnected()).toBe(false); // this fails because it's true |
When tracing the isConnected() call it ends up returning true (always) from here:
If I change the useUnifiedTopology to false and leave everything else the same then the code works as expected and this line is hit instead: