Skip to content

Commit 77f2c08

Browse files
committed
DOCSP-44855: replace parse_async (#138)
(cherry picked from commit 4ddd435)
1 parent 3a35a52 commit 77f2c08

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

source/fundamentals/connections/tls.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Select from the following :guilabel:`Connection String` and
8181
:emphasize-lines: 4-5
8282

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

8686
let tls_opts = TlsOptions::builder().build();
8787
client_options.tls = Some(Tls::Enabled(tls_opts));

source/fundamentals/performance.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ option. The following code demonstrates how to specify a value for
122122

123123
.. code-block:: rust
124124

125-
let mut client_options = ClientOptions::parse_async("<connection string>").await?;
125+
let mut client_options = ClientOptions::parse("<connection string>").await?;
126126
client_options.max_pool_size = Some(20);
127127

128128
let client = Client::with_options(client_options)?;
@@ -156,7 +156,7 @@ instantiating a ``Client``:
156156

157157
.. code-block:: rust
158158

159-
let mut client_options = ClientOptions::parse_async("<connection string>").await?;
159+
let mut client_options = ClientOptions::parse("<connection string>").await?;
160160
client_options.max_connecting = Some(3);
161161
client_options.min_pool_size = Some(1);
162162

@@ -185,7 +185,7 @@ The following code sets the value of the ``max_idle_time`` option to
185185

186186
.. code-block:: rust
187187

188-
let mut client_options = ClientOptions::parse_async("<connection string>").await?;
188+
let mut client_options = ClientOptions::parse("<connection string>").await?;
189189
client_options.max_idle_time = Some(Duration::new(90, 0));
190190

191191
let client = Client::with_options(client_options)?;

source/includes/fundamentals/code-snippets/auth.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use mongodb::{ bson::doc, options::{ ClientOptions, Credential, AuthMechanism },
44
async fn main() -> mongodb::error::Result<()> {
55
// start-default
66
let uri = "<connection string>";
7-
let mut client_options = ClientOptions::parse_async(uri).await?;
7+
let mut client_options = ClientOptions::parse(uri).await?;
88

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

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

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

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

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

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

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

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

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

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

8484
client_options.credential = Some(x509_cred);

source/includes/fundamentals/code-snippets/connection-async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use mongodb::{ bson::doc, options::{ ClientOptions, ServerApi, ServerApiVersion
44
async fn main() -> mongodb::error::Result<()> {
55
// Replace the placeholder with your Atlas connection string
66
let uri = "<connection string>";
7-
let mut client_options = ClientOptions::parse_async(uri).await?;
7+
let mut client_options = ClientOptions::parse(uri).await?;
88

99
// Set the server_api field of the client_options object to Stable API version 1
1010
let server_api = ServerApi::builder().version(ServerApiVersion::V1).build();

source/includes/fundamentals/code-snippets/enterprise-auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use mongodb::{ bson::doc, options::{ ClientOptions, Credential, AuthMechanism },
33
#[tokio::main]
44
async fn main() -> mongodb::error::Result<()> {
55
let uri = "<connection string>";
6-
let mut client_options = ClientOptions::parse_async(uri).await?;
6+
let mut client_options = ClientOptions::parse(uri).await?;
77

88
// start-ldap
99
let plain_cred = Credential::builder()

source/includes/fundamentals/code-snippets/network-compression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use mongodb::{
99
async fn main() -> mongodb::error::Result<()> {
1010
// begin-clientoptions
1111
let uri = "<connection string>";
12-
let mut client_options = ClientOptions::parse_async(uri).await?;
12+
let mut client_options = ClientOptions::parse(uri).await?;
1313

1414
let compressors = vec![
1515
Compressor::Snappy,

source/includes/fundamentals/code-snippets/tls.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ use mongodb::{ options::{ ClientOptions, TlsOptions, Tls }, Client };
55
async fn main() -> mongodb::error::Result<()> {
66
let uri = "<connection string>";
77

8-
let mut client_options = ClientOptions::parse_async(uri).await?;
8+
let mut client_options = ClientOptions::parse(uri).await?;
99

1010
let ca_file = PathBuf::from(r"<path to CA certificate>");
1111
let key_file = PathBuf::from(r"<path to client certificate>");
1212

13-
let tls_opts = TlsOptions::builder()
14-
.ca_file_path(ca_file)
15-
.cert_key_file_path(key_file)
16-
.build();
13+
let tls_opts = TlsOptions::builder().ca_file_path(ca_file).cert_key_file_path(key_file).build();
1714

1815
client_options.tls = Some(Tls::Enabled(tls_opts));
1916
let _client = Client::with_options(client_options)?;

0 commit comments

Comments
 (0)