From 7a0f80f48aa5b43e32434c7a6c1da97fa3fb1619 Mon Sep 17 00:00:00 2001 From: rustagir Date: Wed, 30 Oct 2024 14:19:36 -0400 Subject: [PATCH] DOCSP-44854: fix stable api options code --- source/fundamentals/stable-api.txt | 1 + .../fundamentals/code-snippets/stable-api-behavior.rs | 8 ++------ .../includes/fundamentals/code-snippets/stable-api.rs | 10 +++------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/source/fundamentals/stable-api.txt b/source/fundamentals/stable-api.txt index e492d805..d1f7eabb 100644 --- a/source/fundamentals/stable-api.txt +++ b/source/fundamentals/stable-api.txt @@ -70,6 +70,7 @@ and connects to a server. :dedent: :start-after: start-stable-api :end-before: end-stable-api + :emphasize-lines: 3-4 .. _rust-stable-api-options: diff --git a/source/includes/fundamentals/code-snippets/stable-api-behavior.rs b/source/includes/fundamentals/code-snippets/stable-api-behavior.rs index 20899ec7..ab480466 100644 --- a/source/includes/fundamentals/code-snippets/stable-api-behavior.rs +++ b/source/includes/fundamentals/code-snippets/stable-api-behavior.rs @@ -1,13 +1,9 @@ -use mongodb::{ - bson::doc, - options::{ClientOptions, ServerApi, ServerApiVersion}, - sync::Client, -}; +use mongodb::{ bson::doc, options::{ ClientOptions, ServerApi, ServerApiVersion }, sync::Client }; fn main() -> mongodb::error::Result<()> { let uri = ""; // start-stable-api-behavior - let mut client_options = ClientOptions::parse(uri)?; + let mut client_options = ClientOptions::parse(uri).await?; let server_api = ServerApi::builder() .version(ServerApiVersion::V1) diff --git a/source/includes/fundamentals/code-snippets/stable-api.rs b/source/includes/fundamentals/code-snippets/stable-api.rs index 65baa9f1..55a0d841 100644 --- a/source/includes/fundamentals/code-snippets/stable-api.rs +++ b/source/includes/fundamentals/code-snippets/stable-api.rs @@ -1,14 +1,10 @@ -use mongodb::{ - bson::doc, - options::{ClientOptions, ServerApi, ServerApiVersion}, - sync::Client, -}; +use mongodb::{ bson::doc, options::{ ClientOptions, ServerApi, ServerApiVersion }, sync::Client }; fn main() -> mongodb::error::Result<()> { let uri = ""; - let mut client_options = ClientOptions::parse(uri)?; - // start-stable-api + let mut client_options = ClientOptions::parse(uri).await?; + let server_api = ServerApi::builder().version(ServerApiVersion::V1).build(); client_options.server_api = Some(server_api);