Mongodb driver failed to connect to mongodb atlas cluster

Hi, I am using this driver to connect to my M0 cluster at MongoDB Atlas. A simple:

Mongo.start_link(url: "mongodb+srv://<user>:<password>@fg.nsrxi.mongodb.net/<db-name>?retryWrites=true&w=majority")

failed with error:

Mongo.MongoDBConnection (#PID<0.436.0>) failed to connect: ** (Mongo.Error) <shard-id>.nsrxi.mongodb.net:27017 tcp recv: unknown POSIX error - :closed

Except many of the above error lines in the console, there is no more logs/errors that I see.

However, connecting to the cluster via mongo shell with same connection string works.

Please help, thanks a lot!

I’m seeing something similar. Did you ever manage to find a solution for this issue.

Hey @JD-Robertson did you figure out how to do this? Mind sharing? I’m currently very stuck getting a

{:error, {%ArgumentError{message: "unknown registry: :events_registry"}, [{Registry, :key_info!, 1, [file: 'lib/registry.ex', line: 1341]}, {Registry, :dispatch, 4, [file: 'lib/registry.ex', line: 464]}, {Mongo.Topology, :init, 1, [file: 'lib/mongo/topology.ex', line: 123]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 423]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 390]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]}}

error

It looks like that you didn’t start the application properly, because the registry :events_registry was not started before.