Hello,
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;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let uri = "mongodb+srv://<uname>:<pw>@cluster0.cugioru.mongodb.net/?retryWrites=true&w=majority";
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
Ok(())
}
Help is appreciated. Thanks in advance