MongoDB not connecting in private network

I'm running a Python API and everything is working correctly except the MongoDB connection. I always get this error: localhost:27017: [Errno 111] Connection refused (configured timeouts: socketTimeoutMS: 20000.0ms My code runs correctly in local environment, I have a MONGO_URI environment var that calls for MONGO_PRIVATE_URL, I have also tried MONGO_URL but it is the same error.
Solution:
as per your logs - localhost:27017 meaning you are not using the mongo client correctly, please refer to its documentation on how to use a url with it....
Jump to solution
3 Replies
Percy
Percy4mo ago
Project ID: c91eea90-9200-4a5c-bd45-7ef27e9b091e
jesuspaleta
jesuspaletaOP4mo ago
c91eea90-9200-4a5c-bd45-7ef27e9b091e
Solution
Brody
Brody4mo ago
as per your logs - localhost:27017 meaning you are not using the mongo client correctly, please refer to its documentation on how to use a url with it.
Want results from more Discord servers?
Add your server