@@ -1373,61 +1373,61 @@ type GenericResult<T> = std::result::Result<T, Box<dyn std::error::Error>>;
1373
1373
1374
1374
#[ allow( unused_variables) ]
1375
1375
#[ cfg( not( feature = "sync" ) ) ]
1376
- async fn versioned_api_examples ( ) -> GenericResult < ( ) > {
1376
+ async fn stable_api_examples ( ) -> GenericResult < ( ) > {
1377
1377
let setup_client = TestClient :: new ( ) . await ;
1378
1378
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" ) ;
1380
1380
return Ok ( ( ) ) ;
1381
1381
}
1382
1382
if setup_client. is_sharded ( ) && setup_client. server_version <= Version :: new ( 5 , 0 , 2 ) {
1383
1383
// See SERVER-58794.
1384
1384
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" ,
1386
1386
) ;
1387
1387
return Ok ( ( ) ) ;
1388
1388
}
1389
1389
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" ) ;
1391
1391
return Ok ( ( ) ) ;
1392
1392
}
1393
1393
1394
1394
let uri = DEFAULT_URI . clone ( ) ;
1395
- // Start Versioned API Example 1
1395
+ // Start Stable API Example 1
1396
1396
let mut options = ClientOptions :: parse ( & uri) . await ?;
1397
1397
let server_api = ServerApi :: builder ( ) . version ( ServerApiVersion :: V1 ) . build ( ) ;
1398
1398
options. server_api = Some ( server_api) ;
1399
1399
let client = Client :: with_options ( options) ?;
1400
- // End Versioned API Example 1
1400
+ // End Stable API Example 1
1401
1401
1402
- // Start Versioned API Example 2
1402
+ // Start Stable API Example 2
1403
1403
let mut options = ClientOptions :: parse ( & uri) . await ?;
1404
1404
let server_api = ServerApi :: builder ( )
1405
1405
. version ( ServerApiVersion :: V1 )
1406
1406
. strict ( true )
1407
1407
. build ( ) ;
1408
1408
options. server_api = Some ( server_api) ;
1409
1409
let client = Client :: with_options ( options) ?;
1410
- // End Versioned API Example 2
1410
+ // End Stable API Example 2
1411
1411
1412
- // Start Versioned API Example 3
1412
+ // Start Stable API Example 3
1413
1413
let mut options = ClientOptions :: parse ( & uri) . await ?;
1414
1414
let server_api = ServerApi :: builder ( )
1415
1415
. version ( ServerApiVersion :: V1 )
1416
1416
. strict ( false )
1417
1417
. build ( ) ;
1418
1418
options. server_api = Some ( server_api) ;
1419
1419
let client = Client :: with_options ( options) ?;
1420
- // End Versioned API Example 3
1420
+ // End Stable API Example 3
1421
1421
1422
- // Start Versioned API Example 4
1422
+ // Start Stable API Example 4
1423
1423
let mut options = ClientOptions :: parse ( & uri) . await ?;
1424
1424
let server_api = ServerApi :: builder ( )
1425
1425
. version ( ServerApiVersion :: V1 )
1426
1426
. deprecation_errors ( true )
1427
1427
. build ( ) ;
1428
1428
options. server_api = Some ( server_api) ;
1429
1429
let client = Client :: with_options ( options) ?;
1430
- // End Versioned API Example 4
1430
+ // End Stable API Example 4
1431
1431
1432
1432
let mut options = ClientOptions :: parse ( & uri) . await ?;
1433
1433
let server_api = ServerApi :: builder ( )
@@ -1436,12 +1436,12 @@ async fn versioned_api_examples() -> GenericResult<()> {
1436
1436
. build ( ) ;
1437
1437
options. server_api = Some ( server_api) ;
1438
1438
let client = Client :: with_options ( options) ?;
1439
- let db = client. database ( "versioned -api-migration-examples" ) ;
1439
+ let db = client. database ( "stable -api-migration-examples" ) ;
1440
1440
db. collection :: < Document > ( "sales" ) . drop ( None ) . await ?;
1441
1441
1442
1442
use std:: { error:: Error , result:: Result } ;
1443
1443
1444
- // Start Versioned API Example 5
1444
+ // Start Stable API Example 5
1445
1445
// With the `bson-chrono-0_4` feature enabled, this function can be dropped in favor of using
1446
1446
// `chrono::DateTime` values directly.
1447
1447
fn iso_date ( text : & str ) -> Result < bson:: DateTime , Box < dyn Error > > {
@@ -1458,9 +1458,9 @@ async fn versioned_api_examples() -> GenericResult<()> {
1458
1458
doc! { "_id" : 7 , "item" : "xyz" , "price" : 5 , "quantity" : 10 , "date" : iso_date( "2021-02-15T14:12:12Z" ) ? } ,
1459
1459
doc! { "_id" : 8 , "item" : "abc" , "price" : 10 , "quantity" : 5 , "date" : iso_date( "2021-03-16T20:20:13Z" ) ? }
1460
1460
] , None ) . await ?;
1461
- // End Versioned API Example 5
1461
+ // End Stable API Example 5
1462
1462
1463
- // Start Versioned API Example 6
1463
+ // Start Stable API Example 6
1464
1464
let result = db
1465
1465
. run_command (
1466
1466
doc ! {
@@ -1476,28 +1476,28 @@ async fn versioned_api_examples() -> GenericResult<()> {
1476
1476
// CommandError {
1477
1477
// code: 323,
1478
1478
// 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/ ",
1480
1480
// },
1481
1481
// )
1482
1482
}
1483
- // End Versioned API Example 6
1483
+ // End Stable API Example 6
1484
1484
if let ErrorKind :: Command ( ref err) = * result. as_ref ( ) . unwrap_err ( ) . kind {
1485
1485
assert_eq ! ( err. code, 323 ) ;
1486
1486
assert_eq ! ( err. code_name, "APIStrictError" . to_string( ) ) ;
1487
1487
} else {
1488
1488
panic ! ( "invalid result {:?}" , result) ;
1489
1489
} ;
1490
1490
1491
- // Start Versioned API Example 7
1491
+ // Start Stable API Example 7
1492
1492
let count = db
1493
1493
. collection :: < Document > ( "sales" )
1494
1494
. count_documents ( None , None )
1495
1495
. await ?;
1496
- // End Versioned API Example 7
1496
+ // End Stable API Example 7
1497
1497
1498
- // Start Versioned API Example 8
1498
+ // Start Stable API Example 8
1499
1499
assert_eq ! ( count, 8 ) ;
1500
- // End Versioned API Example 8
1500
+ // End Stable API Example 8
1501
1501
1502
1502
Ok ( ( ) )
1503
1503
}
@@ -1850,7 +1850,7 @@ async fn test() {
1850
1850
projection_examples ( & coll) . await . unwrap ( ) ;
1851
1851
update_examples ( & coll) . await . unwrap ( ) ;
1852
1852
delete_examples ( & coll) . await . unwrap ( ) ;
1853
- versioned_api_examples ( ) . await . unwrap ( ) ;
1853
+ stable_api_examples ( ) . await . unwrap ( ) ;
1854
1854
aggregation_examples ( ) . await . unwrap ( ) ;
1855
1855
run_command_examples ( ) . await . unwrap ( ) ;
1856
1856
index_examples ( ) . await . unwrap ( ) ;
0 commit comments