Skip to content

Commit ae4ae58

Browse files
RUST-1173 Replace "Versioned API" references with "Stable API" (#585)
1 parent 8e07cf4 commit ae4ae58

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

src/client/options/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ impl<'de> Deserialize<'de> for ServerApiVersion {
322322
}
323323
}
324324

325-
/// Options used to declare a versioned server API. For more information, see the [Versioned API](
326-
/// https://docs.mongodb.com/v5.0/reference/versioned-api/) manual page.
325+
/// Options used to declare a stable server API. For more information, see the [Stable API](
326+
/// https://docs.mongodb.com/v5.0/reference/stable-api/) manual page.
327327
#[serde_with::skip_serializing_none]
328328
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, TypedBuilder)]
329329
#[builder(field_defaults(setter(into)))]
@@ -506,13 +506,13 @@ pub struct ClientOptions {
506506
/// The declared API version is applied to all commands run through the client, including those
507507
/// sent through any handle derived from the client.
508508
///
509-
/// Specifying versioned API options in the command document passed to `run_command` AND
509+
/// Specifying stable API options in the command document passed to `run_command` AND
510510
/// declaring an API version on the client is not supported and is considered undefined
511511
/// behaviour. To run any command with a different API version or without declaring one, create
512512
/// a separate client that declares the appropriate API version.
513513
///
514-
/// For more information, see the [Versioned API](
515-
/// https://docs.mongodb.com/v5.0/reference/versioned-api/) manual page.
514+
/// For more information, see the [Stable API](
515+
/// https://docs.mongodb.com/v5.0/reference/stable-api/) manual page.
516516
#[builder(default)]
517517
pub server_api: Option<ServerApi>,
518518

src/test/documentation_examples/mod.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,61 +1373,61 @@ type GenericResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
13731373

13741374
#[allow(unused_variables)]
13751375
#[cfg(not(feature = "sync"))]
1376-
async fn versioned_api_examples() -> GenericResult<()> {
1376+
async fn stable_api_examples() -> GenericResult<()> {
13771377
let setup_client = TestClient::new().await;
13781378
if setup_client.server_version_lt(4, 9) {
1379-
log_uncaptured("skipping versioned API examples due to unsupported server version");
1379+
log_uncaptured("skipping stable API examples due to unsupported server version");
13801380
return Ok(());
13811381
}
13821382
if setup_client.is_sharded() && setup_client.server_version <= Version::new(5, 0, 2) {
13831383
// See SERVER-58794.
13841384
log_uncaptured(
1385-
"skipping versioned API examples due to unsupported server version on sharded topology",
1385+
"skipping stable API examples due to unsupported server version on sharded topology",
13861386
);
13871387
return Ok(());
13881388
}
13891389
if setup_client.is_load_balanced() {
1390-
log_uncaptured("skipping versioned API examples due to load-balanced topology");
1390+
log_uncaptured("skipping stable API examples due to load-balanced topology");
13911391
return Ok(());
13921392
}
13931393

13941394
let uri = DEFAULT_URI.clone();
1395-
// Start Versioned API Example 1
1395+
// Start Stable API Example 1
13961396
let mut options = ClientOptions::parse(&uri).await?;
13971397
let server_api = ServerApi::builder().version(ServerApiVersion::V1).build();
13981398
options.server_api = Some(server_api);
13991399
let client = Client::with_options(options)?;
1400-
// End Versioned API Example 1
1400+
// End Stable API Example 1
14011401

1402-
// Start Versioned API Example 2
1402+
// Start Stable API Example 2
14031403
let mut options = ClientOptions::parse(&uri).await?;
14041404
let server_api = ServerApi::builder()
14051405
.version(ServerApiVersion::V1)
14061406
.strict(true)
14071407
.build();
14081408
options.server_api = Some(server_api);
14091409
let client = Client::with_options(options)?;
1410-
// End Versioned API Example 2
1410+
// End Stable API Example 2
14111411

1412-
// Start Versioned API Example 3
1412+
// Start Stable API Example 3
14131413
let mut options = ClientOptions::parse(&uri).await?;
14141414
let server_api = ServerApi::builder()
14151415
.version(ServerApiVersion::V1)
14161416
.strict(false)
14171417
.build();
14181418
options.server_api = Some(server_api);
14191419
let client = Client::with_options(options)?;
1420-
// End Versioned API Example 3
1420+
// End Stable API Example 3
14211421

1422-
// Start Versioned API Example 4
1422+
// Start Stable API Example 4
14231423
let mut options = ClientOptions::parse(&uri).await?;
14241424
let server_api = ServerApi::builder()
14251425
.version(ServerApiVersion::V1)
14261426
.deprecation_errors(true)
14271427
.build();
14281428
options.server_api = Some(server_api);
14291429
let client = Client::with_options(options)?;
1430-
// End Versioned API Example 4
1430+
// End Stable API Example 4
14311431

14321432
let mut options = ClientOptions::parse(&uri).await?;
14331433
let server_api = ServerApi::builder()
@@ -1436,12 +1436,12 @@ async fn versioned_api_examples() -> GenericResult<()> {
14361436
.build();
14371437
options.server_api = Some(server_api);
14381438
let client = Client::with_options(options)?;
1439-
let db = client.database("versioned-api-migration-examples");
1439+
let db = client.database("stable-api-migration-examples");
14401440
db.collection::<Document>("sales").drop(None).await?;
14411441

14421442
use std::{error::Error, result::Result};
14431443

1444-
// Start Versioned API Example 5
1444+
// Start Stable API Example 5
14451445
// With the `bson-chrono-0_4` feature enabled, this function can be dropped in favor of using
14461446
// `chrono::DateTime` values directly.
14471447
fn iso_date(text: &str) -> Result<bson::DateTime, Box<dyn Error>> {
@@ -1458,9 +1458,9 @@ async fn versioned_api_examples() -> GenericResult<()> {
14581458
doc! { "_id" : 7, "item" : "xyz", "price" : 5, "quantity" : 10, "date" : iso_date("2021-02-15T14:12:12Z")? },
14591459
doc! { "_id" : 8, "item" : "abc", "price" : 10, "quantity" : 5, "date" : iso_date("2021-03-16T20:20:13Z")? }
14601460
], None).await?;
1461-
// End Versioned API Example 5
1461+
// End Stable API Example 5
14621462

1463-
// Start Versioned API Example 6
1463+
// Start Stable API Example 6
14641464
let result = db
14651465
.run_command(
14661466
doc! {
@@ -1476,28 +1476,28 @@ async fn versioned_api_examples() -> GenericResult<()> {
14761476
// CommandError {
14771477
// code: 323,
14781478
// code_name: "APIStrictError",
1479-
// message: "Provided apiStrict:true, but the command count is not in API Version 1. Information on supported commands and migrations in API Version 1 can be found at https://dochub.mongodb.org/core/manual-versioned-api",
1479+
// message: "Provided apiStrict:true, but the command count is not in API Version 1. Information on supported commands and migrations in API Version 1 can be found at https://docs.mongodb.com/v5.0/reference/stable-api/",
14801480
// },
14811481
// )
14821482
}
1483-
// End Versioned API Example 6
1483+
// End Stable API Example 6
14841484
if let ErrorKind::Command(ref err) = *result.as_ref().unwrap_err().kind {
14851485
assert_eq!(err.code, 323);
14861486
assert_eq!(err.code_name, "APIStrictError".to_string());
14871487
} else {
14881488
panic!("invalid result {:?}", result);
14891489
};
14901490

1491-
// Start Versioned API Example 7
1491+
// Start Stable API Example 7
14921492
let count = db
14931493
.collection::<Document>("sales")
14941494
.count_documents(None, None)
14951495
.await?;
1496-
// End Versioned API Example 7
1496+
// End Stable API Example 7
14971497

1498-
// Start Versioned API Example 8
1498+
// Start Stable API Example 8
14991499
assert_eq!(count, 8);
1500-
// End Versioned API Example 8
1500+
// End Stable API Example 8
15011501

15021502
Ok(())
15031503
}
@@ -1850,7 +1850,7 @@ async fn test() {
18501850
projection_examples(&coll).await.unwrap();
18511851
update_examples(&coll).await.unwrap();
18521852
delete_examples(&coll).await.unwrap();
1853-
versioned_api_examples().await.unwrap();
1853+
stable_api_examples().await.unwrap();
18541854
aggregation_examples().await.unwrap();
18551855
run_command_examples().await.unwrap();
18561856
index_examples().await.unwrap();

0 commit comments

Comments
 (0)