2525using MongoDB . Bson . TestHelpers . XunitExtensions ;
2626using MongoDB . Driver . Core . Bindings ;
2727using MongoDB . Driver . Core . Clusters ;
28+ using MongoDB . Driver . Core . Misc ;
2829using MongoDB . Driver . Core . Operations ;
2930using MongoDB . Driver . Core . TestHelpers . XunitExtensions ;
3031using MongoDB . Driver . Tests ;
@@ -381,8 +382,14 @@ public void AggregateToCollection_should_throw_when_last_stage_is_not_an_output_
381382 [ ParameterAttributeData ]
382383 public void CreateCollection_should_execute_a_CreateCollectionOperation_when_options_is_generic(
383384 [ Values ( false , true ) ] bool usingSession,
385+ [ Values ( false , true ) ] bool clustered,
384386 [ Values ( false , true ) ] bool async)
385387 {
388+ if ( clustered )
389+ {
390+ RequireServer . Check ( ) . Supports ( Feature . ClusteredIndexes ) ;
391+ }
392+
386393 var writeConcern = new WriteConcern ( 1 ) ;
387394 var subject = _subject. WithWriteConcern( writeConcern ) ;
388395 var session = CreateSession ( usingSession ) ;
@@ -395,6 +402,7 @@ public void CreateCollection_should_execute_a_CreateCollectionOperation_when_opt
395402 {
396403 AutoIndexId = false ,
397404 Capped = true ,
405+ ClusteredIndex = clustered ? new ClusteredIndexOptions < BsonDocument > ( ) : null ,
398406 Collation = new Collation ( "en_US" ) ,
399407 IndexOptionDefaults = new IndexOptionDefaults { StorageEngine = new BsonDocument ( "x" , 1 ) } ,
400408 MaxDocuments = 10 ,
@@ -441,6 +449,14 @@ public void CreateCollection_should_execute_a_CreateCollectionOperation_when_opt
441449 op. AutoIndexId . Should ( ) . Be ( options . AutoIndexId ) ;
442450#pragma warning restore
443451 op. Capped . Should ( ) . Be ( options . Capped ) ;
452+ if ( clustered )
453+ {
454+ op. ClusteredIndex . Should ( ) . NotBeNull ( ) ;
455+ }
456+ else
457+ {
458+ op. ClusteredIndex . Should ( ) . BeNull ( ) ;
459+ }
444460 op. Collation . Should ( ) . BeSameAs ( options . Collation ) ;
445461 op. IndexOptionDefaults . ToBsonDocument ( ) . Should ( ) . Be ( options . IndexOptionDefaults . ToBsonDocument ( ) ) ;
446462 op. MaxDocuments . Should ( ) . Be ( options . MaxDocuments ) ;
@@ -515,6 +531,7 @@ public void CreateCollection_should_execute_a_CreateCollectionOperation_when_opt
515531 op. AutoIndexId . Should ( ) . Be ( options . AutoIndexId ) ;
516532#pragma warning restore
517533 op. Capped . Should ( ) . Be ( options . Capped ) ;
534+ op. ClusteredIndex . Should ( ) . BeNull ( ) ;
518535 op. Collation . Should ( ) . BeSameAs ( options . Collation ) ;
519536 op. IndexOptionDefaults . ToBsonDocument ( ) . Should ( ) . Be ( options . IndexOptionDefaults . ToBsonDocument ( ) ) ;
520537 op. MaxDocuments . Should ( ) . Be ( options . MaxDocuments ) ;
@@ -571,6 +588,7 @@ public void CreateCollection_should_execute_a_CreateCollectionOperation_when_opt
571588 op. AutoIndexId . Should ( ) . NotHaveValue ( ) ;
572589#pragma warning restore
573590 op. Capped . Should ( ) . NotHaveValue ( ) ;
591+ op. ClusteredIndex . Should ( ) . BeNull ( ) ;
574592 op. IndexOptionDefaults . Should ( ) . BeNull ( ) ;
575593 op. MaxDocuments . Should ( ) . NotHaveValue ( ) ;
576594 op. MaxSize . Should ( ) . NotHaveValue ( ) ;
0 commit comments