Puneet Naik
Puneet Naik

Reputation: 19

Connection to Mongodb Atlas cluster is closing unexpectedly

I am getting mongo error ie 'connection to MongoDB closed' for every other database request that I am making, I looked it up and the solutions were whitelisting IP - added 0.0.0.0/0 to allowed IP, setting up the URI correctly, Checking connection - was able to connect from Studio 3t application,

The error Log says:

MongoError: connection 72 to cluster0-shard-00-01-****.mongodb.net:27017 closed
    at Function.MongoError.create (/**/node_modules/mongodb-core/lib/error.js:29:11)
    at TLSSocket.<anonymous> (/**/node_modules/mongodb-core/lib/connection/connection.js:214:22)
    at Object.onceWrapper (events.js:285:13)
    at TLSSocket.emit (events.js:202:15)
    at TLSSocket.EventEmitter.emit (domain.js:446:20)
    at _handle.close (net.js:611:12)
    at Socket.done (_tls_wrap.js:412:7)
    at Object.onceWrapper (events.js:285:13)
    at Socket.emit (events.js:197:13)
    at Socket.EventEmitter.emit (domain.js:446:20)
    at TCP._handle.close (net.js:611:12)

I have tried everything with no results, If someone can help me out for which direction to look into or anyone who has faced it and resolved it who can guide me, it would be much appreciated.

Upvotes: 1

Views: 1191

Answers (1)

Momchil Mitev
Momchil Mitev

Reputation: 21

Go to your cluster network access and add again your IP address in the IP Whitelist. I am using wi-fi and my id change periodically.

Upvotes: 2

Related Questions