Custom database connect to MongoDB Cloud Atlas

I was able to set up a custom database connection and manage my users by creating an Azure Cosmos DB (mongodb). I attempted to connect to a MongoDB Cloud Atlas cluster, but I had no success. I believe it has something to do with the version of the NodeJS driver used, but I’m not familiar enough to know what questions to ask or how to troubleshoot.

The MongoDB Cloud Atlas offers two example connection strings, based on the driver version being used, but neither seem to work for me.

Using Driver 3.6 or later:

Connection string example:
mongodb+srv://myuser:userpass@clustername.mongodb.net/dbname?retryWrites=true

Error message received:
[SandboxUnhandledError] unknown mongodb+srv://myuser:userpass@clustername.mongodb.net/dbname?retryWrites=true config

Using Driver 3.4 or earlier:

Connection string example:
mongodb://myuser:userpass@clustershardname.mongodb.net:27017,clustershardname.mongodb.net:27017,clustershardname.mongodb.net:27017/dbname?ssl=true&replicaSet=clustershardname&authSource=admin&retryWrites=true

Error message received:
[Error] Error: Client request error: socket hang up

Has anyone has success connecting their Custom Database to MongoDB Cloud Atlas cluster?

Hey @gopherr127!

As it has been more than a few months since this topic was opened and there has been no reply or further information provided from the community as to the existence of the issue we would like to check if you are still facing the described challenge?

We are more than happy to assist in any way! If the issue is still out there please let us know so we can create a new thread for better visibility, otherwise we’ll close this one in week’s time.

Thank you!

This topic was automatically closed after 5 days. New replies are no longer allowed.