Can't Connect To MongoDB Atlas Cluster
See original GitHub issueIssue type:
[ ] question [X] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[X] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[X] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
I have a valid connection string to a Mongo Atlas DB that I am trying to use with TypeORM. I know the connection string works because I have used it from Python and from the Mongo shell. But it doesn’t work from typeorm. I have tried both the mongodb:// and mongo+srv synax. Not sure how to debug or figure this one out. Here is the error:
(node:19257) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
{ MongoNetworkError: connection 5 to cluster0-XXXX.mongodb.net:27017 closed
at Socket.<anonymous> (/home/administrator/Source/Repos/emoon-relayer/node_modules/mongodb-core/lib/connection/connection.js:276:9)
at Object.onceWrapper (events.js:273:13)
at Socket.emit (events.js:182:13)
at TCP._handle.close (net.js:611:12)
name: 'MongoNetworkError',
errorLabels: [ 'TransientTransactionError' ],
[Symbol(mongoErrorContextSymbol)]: {} }
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:19 (4 by maintainers)
Top Results From Across the Web
Can't connect to mongodb.Could not connect to any servers in ...
First try to Allow Access From Anywhere. If it works it is most likely because you whitelisted an IP address that is not...
Read more >"Could not connect to any servers in your MongoDB Atlas ...
In your Mongo project, go to the network access section, and edit the IP to allow access from anywhere ( ...
Read more >Could not connect to any servers in your MongoDB Atlas cluster.
Go to Network Access in Security section. Click + Add IP Address button. Click Add current IP address . Access your localhost and ......
Read more >NodeJS Container can't connect to MongoDB Atlas Cluster
NodeJS Container can't connect to MongoDB Atlas Cluster ... Hello docker devs: I'm using docker with node js and MongoDB atlas cluster.
Read more >Can't connect to MongoDB atlas serverless instance
'm trying to connect to an Atlas Serverless database from Nodejs. It just won't work. Tried and triple checked everything I found. mongosh ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After few tries I have two valid configurations for typeorm and mongo atlas:
and second one
But I think @pointtoken is right. Calling mongodb connect method with undefined option properties overwrites settings from url.
So the below worked for me. I am using Nestjs