We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9fa1655 commit 781da09Copy full SHA for 781da09
tests/connection_snippets.rs
@@ -0,0 +1,20 @@
1
+#![allow(dead_code)]
2
+#![allow(unused_imports)]
3
+#![allow(unused_variables)]
4
+
5
+extern crate mongodb;
6
7
+#[cfg(feature = "tokio-runtime")]
8
+// CONNECTION EXAMPLE STARTS HERE
9
+#[tokio::main]
10
+async fn main() -> mongodb::error::Result<()> {
11
+ use mongodb::{options::ClientOptions, Client};
12
+ let client_options = ClientOptions::parse(
13
+ "mongodb+srv://<username>:<password>@<cluster-url>/<dbname>?w=majority",
14
+ )
15
+ .await?;
16
+ let client = Client::with_options(client_options)?;
17
+ let database = client.database("test");
18
+ Ok(())
19
+}
20
+// CONNECTION EXAMPLE ENDS HERE
0 commit comments