-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix error handler in topology.connect #1812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if topology.connect has an error, topology is "overwritten", changing the function parameter to a new name, let's "force close" the old instance.
@simllll @mbroadst I can confirm this fixes an issue that's popping up in the Mongoose tests. I looked into it and it is a minor issue that seems to pop up when you specify the const { MongoClient } = require('mongodb');
run().catch(error => console.error(error.stack));
async function run() {
// Fails with "Cannot read property 'close' of undefined" if localhost:27017 is a standalone
await MongoClient.connect('mongodb://localhost:27017/test', { replicaSet: 'rs', useNewUrlParser: true });
} We can work around this for now |
@vkarpov15 @simllll thanks for catching this! It's strange because it should technically be the same object, but I definitely prefer the enhanced readability. We're working diligently on a fix for the change streams resume issues, so this fix here will likely make it into a patch release this week including that and updated kerberos support. |
if topology.connect has an error, topology is "overwritten" which leads to an error like:
changing the function parameter to a new name, let's "force close" the old instance.