Getting DNS operation timed out error

When the driver connects to “mongodb+srv://” connection strings it must perform SRV and TXT lookups via DNS. If those lookups consistently time out that indicates a DNS misconfiguration in the network; perhaps there’s some throttling going on or these DNS queries are being dropped/blocked.

One option that’s always available to workaround these issues is to switch to using the old-style “mongodb://” connection string. You can find this in the Atlas cluster UI, https://www.mongodb.com/docs/guides/atlas/connection-string/, going to “connect your application” and then choosing the oldest driver version (choosing the newer driver version will give you a “mongodb+srv://” connection string).

2 Likes