@@ -5,7 +5,7 @@ use tokio::sync::RwLockReadGuard;
5
5
use crate :: {
6
6
bson:: { doc, Bson } ,
7
7
error:: Result ,
8
- options:: { ClientOptions , CursorType , FindOptions , ServerApi , ServerApiVersion } ,
8
+ options:: { ClientOptions , FindOptions , ServerApi , ServerApiVersion } ,
9
9
test:: { TestClient , DEFAULT_URI , LOCK } ,
10
10
Client ,
11
11
Collection ,
@@ -1377,47 +1377,42 @@ async fn versioned_api_examples() -> Result<()> {
1377
1377
}
1378
1378
1379
1379
let uri = DEFAULT_URI . clone ( ) ;
1380
- // Start 1. Declare an API version on a client
1380
+ // Start Versioned API Example 1
1381
1381
let mut options = ClientOptions :: parse ( & uri) . await ?;
1382
1382
let server_api = ServerApi :: builder ( ) . version ( ServerApiVersion :: V1 ) . build ( ) ;
1383
1383
options. server_api = Some ( server_api) ;
1384
1384
let client = Client :: with_options ( options) ?;
1385
- let cursor = client
1386
- . database ( "versioned_api_example" )
1387
- . collection :: < Document > ( "example" )
1388
- . find ( None , None )
1389
- . await ?;
1390
- // End 1.
1385
+ // End Versioned API Example 1
1391
1386
1392
- // Start 2. Strict option
1387
+ // Start Versioned API Example 2
1393
1388
let mut options = ClientOptions :: parse ( & uri) . await ?;
1394
1389
let server_api = ServerApi :: builder ( )
1395
1390
. version ( ServerApiVersion :: V1 )
1396
1391
. strict ( true )
1397
1392
. build ( ) ;
1398
1393
options. server_api = Some ( server_api) ;
1399
1394
let client = Client :: with_options ( options) ?;
1395
+ // End Versioned API Example 2
1400
1396
1401
- let find_options = FindOptions :: builder ( )
1402
- . cursor_type ( CursorType :: Tailable )
1397
+ // Start Versioned API Example 3
1398
+ let mut options = ClientOptions :: parse ( & uri) . await ?;
1399
+ let server_api = ServerApi :: builder ( )
1400
+ . version ( ServerApiVersion :: V1 )
1401
+ . strict ( false )
1403
1402
. build ( ) ;
1404
- let cursor = client
1405
- . database ( "versioned_api_example" )
1406
- . collection :: < Document > ( "example" )
1407
- . find ( None , find_options)
1408
- . await
1409
- . expect_err ( "should fail" ) ;
1410
- // End 2.
1403
+ options. server_api = Some ( server_api) ;
1404
+ let client = Client :: with_options ( options) ?;
1405
+ // End Versioned API Example 3
1411
1406
1412
- // Start 3. deprecationErrors option
1407
+ // Start Versioned API Example 4
1413
1408
let mut options = ClientOptions :: parse ( & uri) . await ?;
1414
1409
let server_api = ServerApi :: builder ( )
1415
1410
. version ( ServerApiVersion :: V1 )
1416
1411
. deprecation_errors ( true )
1417
1412
. build ( ) ;
1418
1413
options. server_api = Some ( server_api) ;
1419
1414
let client = Client :: with_options ( options) ?;
1420
- // End 3.
1415
+ // End Versioned API Example 4
1421
1416
1422
1417
Ok ( ( ) )
1423
1418
}
0 commit comments