-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.3.2
-
Component/s: MongoDB 3.2
-
Environment:Not using Mongoose. Not transpiling the driver.
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: