Skip to content

DOCSP-44854: fix stable api options code #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 30, 2024
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
1 change: 1 addition & 0 deletions source/fundamentals/stable-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
@@ -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 = "<connection string>";
// 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)
Expand Down
10 changes: 3 additions & 7 deletions source/includes/fundamentals/code-snippets/stable-api.rs
Original file line number Diff line number Diff line change
@@ -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 = "<connection string>";
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);

Expand Down
Loading