Rust driver : DnsResolve { message: "No connections available" }


I’ve been trying to run a very simple program, to test out mongo with rust. However, I can’t seem to connect at all

I keep getting DnsResolve { message: "No connections available" }
My coworkers, running the exact same code are getting no errors. So it must be a problem on my side but there is no documentation or info anywhere to help me find out what this problem could be.

Here is the code, with credentials obstructed obv

use mongodb::{bson::doc, options::ClientOptions, Client};

use std::error::Error;

async fn main() -> Result<(), Box<dyn Error>> {
     let uri = "mongodb+srv://<uname>:<pw>";
     let mut client_options = ClientOptions::parse(uri).await.unwrap();

    client_options.app_name = Some("My App".to_string());

   ERROR HERE >>> let client: Client = Client::with_options(client_options).unwrap();
    let mut client_options = ClientOptions::parse(uri).await.unwrap();

   ... Do stuff with client


Help is appreciated. Thanks in advance

Hi @FQuark,

I’m not too familiar with rust but based off the error, it might be related to the DNS resolution of the SRV record. Are your co-workers connecting to the cluster using a different network?

Could you also try the following from the same client and advise the output?

nslookup -type=srv
nslookup -type=txt

From my own network I was able to resolve the 3 hostnames associated with the above record.

Look forward to hearing from you.



Sorry for the very long delay. I was using a workaround using a different machine which isn’t very convenient.

My co-workers are indeed working from a different network. This seems to be machine specific as other devices on my network are able to connect.

Running those lookups, none of them are connecting on my work machine, but they all work on my personal one.

I’m running Arch linux-lts 6.1.31-1 on Wayland, and iwd on its own for network stuff.

Thanks for the help, sorry again for the delay

I do agree with your assessment here regarding the issue being specific to the problem machine. In saying so, it doesn’t appear that this is a MongoDB related issue. Unfortunately I am not too familiar with the environment you have specified below and how to troubleshoot DNS issues here:

Generally the Google DNS servers are able to resolve the Atlas DNS SRV records - I am not sure of the steps of how to force your machine to use this DNS but is it something you have tried from a troubleshooting perspective?