Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/fundamentals/connections/tls.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Select from the following :guilabel:`Connection String` and
:emphasize-lines: 4-5

let uri = "<connection string>"
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

let tls_opts = TlsOptions::builder().build();
client_options.tls = Some(Tls::Enabled(tls_opts));
Expand Down
12 changes: 6 additions & 6 deletions source/includes/fundamentals/code-snippets/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use mongodb::{ bson::doc, options::{ ClientOptions, Credential, AuthMechanism },
async fn main() -> mongodb::error::Result<()> {
// start-default
let uri = "<connection string>";
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

let default_cred = Credential::builder()
.username("<username>".to_string())
Expand All @@ -18,7 +18,7 @@ async fn main() -> mongodb::error::Result<()> {

// start-scramsha256
let uri = "<connection string>";
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

let scram_sha_256_cred = Credential::builder()
.username("<username>".to_string())
Expand All @@ -33,7 +33,7 @@ async fn main() -> mongodb::error::Result<()> {

// start-scramsha1
let uri = "<connection string>";
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

let scram_sha_1_cred = Credential::builder()
.username("<username>".to_string())
Expand All @@ -48,7 +48,7 @@ async fn main() -> mongodb::error::Result<()> {

// start-aws
let uri = "<connection string>";
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

let aws_cred = Credential::builder()
.username("<access key ID>".to_string())
Expand All @@ -64,7 +64,7 @@ async fn main() -> mongodb::error::Result<()> {

// start-aws-env-var
let uri = "<connection string>";
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

let aws_cred = Credential::builder().mechanism(AuthMechanism::MongoDbAws).build();

Expand All @@ -78,7 +78,7 @@ async fn main() -> mongodb::error::Result<()> {
tlsCAFile = "<path to CA certificate>",
tlsCertificateKeyFile = "<path to private client key>"
);
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;
let x509_cred = Credential::builder().mechanism(AuthMechanism::MongoDbAws).build();

client_options.credential = Some(x509_cred);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use mongodb::{ bson::doc, options::{ ClientOptions, ServerApi, ServerApiVersion
async fn main() -> mongodb::error::Result<()> {
// Replace the placeholder with your Atlas connection string
let uri = "<connection string>";
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

// Set the server_api field of the client_options object to Stable API version 1
let server_api = ServerApi::builder().version(ServerApiVersion::V1).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use mongodb::{ bson::doc, options::{ ClientOptions, Credential, AuthMechanism },
#[tokio::main]
async fn main() -> mongodb::error::Result<()> {
let uri = "<connection string>";
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

// start-ldap
let plain_cred = Credential::builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use mongodb::{
fn main() -> mongodb::error::Result<()> {
let uri = "<connection string>";

let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

// begin-command
struct CommandStartHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use mongodb::{
fn main() -> mongodb::error::Result<()> {
let uri = "<connection string>";

let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

// begin-cmap
struct ConnectionCreatedHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use mongodb::{
fn main() -> mongodb::error::Result<()> {
let uri = "<connection string>";

let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

// begin-sdam
struct ServerOpenHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use mongodb::{
async fn main() -> mongodb::error::Result<()> {
// begin-clientoptions
let uri = "<connection string>";
let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

let compressors = vec![
Compressor::Snappy,
Expand Down
2 changes: 1 addition & 1 deletion source/includes/fundamentals/code-snippets/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use mongodb::{ options::{ ClientOptions, TlsOptions, Tls }, Client };
async fn main() -> mongodb::error::Result<()> {
let uri = "<connection string>";

let mut client_options = ClientOptions::parse(uri).await?;
let mut client_options = ClientOptions::parse_async(uri).await?;

let ca_file = PathBuf::from(r"<path to CA certificate>");
let key_file = PathBuf::from(r"<path to client certificate>");
Expand Down