For me, this issue was only happening in a Starbucks coffee, and was something random, OpenDNS didn't work for me nor Google DNS or any other tried, funny because works just fine at home. Previously I was using mongodb+srv string format to connect inside "uri" using Mongoid and Ruby with a mongoid.yml configuration file.
In order to fix this issue, make sure to follow the configuration described in this link https://docs.atlas.mongodb.com/driver-connection/ (Mongoid Example)
production:
# Configure available database clients. (required)
clients:
# Defines the default client. (required)
default:
# Defines the name of the default database that Mongoid can connect to.
# (required).
database: 'myDatabaseName'
# Provides the hosts the default client can connect to. Must be an array
# of host:port pairs. (required)
hosts:
- mycluster0-shard-00-00.mongodb.net:27017
- mycluster0-shard-00-01.mongodb.net:27017
- mycluster0-shard-00-02.mongodb.net:27017
options:
# The name of the user for authentication.
user: kay
# The password of the user for authentication.
password: myRealPassword
# The database or source to authenticate the user against. If the database
# specified above is not admin, admin MUST be specified here.
auth_source: admin
# All Atlas servers use SSL. (default: false)
ssl: true