2 / 2
Apr 2024

I’m following the golang driver’s quick start guide:

The connection string has the format:
mongodb://:@hostname:port/?authMechanism=SCRAM-SHA-1&authSource=<db_name>

I’ve tried a couple of things and I keep getting the same error:
No connection could be made because the target machine actively refused it

Looking through the codebase for the driver, I can see it’s errWindowsTLSConnectionRefused

As a sanity check, I used the same connection string using the node.js driver, and it successfully connected and was able to insert a document. I also used it in compass and it works as expected.

The mongodb version is 5 and I do not have control over that db.

Any pointers?

Hey @SilverWizard,

Welcome to the MongoDB Community forums :sparkles:

Could you please share the error stack trace and the driver version so the community can assist you better? Also, could you provide the code snippet you are executing?

We look forward to your response.

Additionally, you can refer to our Developer Center for more content on the Go language: Go | MongoDB

Best regards,
Kushagra