@@ -459,48 +459,25 @@ describe('Indexes', function () {
459459 }
460460 } ) ;
461461
462- it ( 'shouldCorrectlyCreateAndUseSparseIndex' , {
463- metadata : {
464- requires : { topology : [ 'single' , 'replicaset' , 'sharded' , 'ssl' , 'heap' , 'wiredtiger' ] }
465- } ,
466-
467- test : function ( done ) {
468- var configuration = this . configuration ;
469- var client = configuration . newClient ( configuration . writeConcernMax ( ) , { maxPoolSize : 1 } ) ;
470- var db = client . db ( configuration . db ) ;
471- db . createCollection ( 'create_and_use_sparse_index_test' , function ( err ) {
472- expect ( err ) . to . not . exist ;
473- const collection = db . collection ( 'create_and_use_sparse_index_test' ) ;
474- collection . createIndex (
475- { title : 1 } ,
476- { sparse : true , writeConcern : { w : 1 } } ,
477- function ( err ) {
478- expect ( err ) . to . not . exist ;
479- collection . insert (
480- [ { name : 'Jim' } , { name : 'Sarah' , title : 'Princess' } ] ,
481- configuration . writeConcernMax ( ) ,
482- function ( err ) {
483- expect ( err ) . to . not . exist ;
484- collection
485- . find ( { title : { $ne : null } } )
486- . sort ( { title : 1 } )
487- . toArray ( function ( err , items ) {
488- test . equal ( 1 , items . length ) ;
489- test . equal ( 'Sarah' , items [ 0 ] . name ) ;
490-
491- // Fetch the info for the indexes
492- collection . indexInformation ( { full : true } , function ( err , indexInfo ) {
493- expect ( err ) . to . not . exist ;
494- test . equal ( 2 , indexInfo . length ) ;
495- client . close ( done ) ;
496- } ) ;
497- } ) ;
498- }
499- ) ;
500- }
501- ) ;
502- } ) ;
503- }
462+ it ( 'shouldCorrectlyCreateAndUseSparseIndex' , async function ( ) {
463+ const db = client . db ( this . configuration . db ) ;
464+ await db . createCollection ( 'create_and_use_sparse_index_test' ) ;
465+ const collection = db . collection ( 'create_and_use_sparse_index_test' ) ;
466+ await collection . createIndex ( { title : 1 } , { sparse : true , writeConcern : { w : 1 } } ) ;
467+ await collection . insertMany (
468+ [ { name : 'Jim' } , { name : 'Sarah' , title : 'Princess' } ] ,
469+ this . configuration . writeConcernMax ( )
470+ ) ;
471+ const items = await collection
472+ . find ( { title : { $ne : null } } )
473+ . sort ( { title : 1 } )
474+ . toArray ( ) ;
475+ expect ( items ) . to . have . lengthOf ( 1 ) ;
476+ expect ( items [ 0 ] ) . to . have . property ( 'name' , 'Sarah' ) ;
477+
478+ // Fetch the info for the indexes
479+ const indexInfo = await collection . indexInformation ( { full : true } ) ;
480+ expect ( indexInfo ) . to . have . lengthOf ( 2 ) ;
504481 } ) ;
505482
506483 it ( 'shouldCorrectlyHandleGeospatialIndexes' , {
0 commit comments