@@ -925,7 +925,7 @@ describe('Bulk', function () {
925925 try {
926926 batch . insert ( { string : hugeString } ) ;
927927 test . ok ( false ) ;
928- } catch ( err ) { } // eslint-disable-line
928+ } catch ( err ) { } // eslint-disable-line
929929
930930 // Finish up test
931931 client . close ( done ) ;
@@ -1216,34 +1216,27 @@ describe('Bulk', function () {
12161216 }
12171217 } ) ;
12181218
1219- it ( 'should correctly execute unordered batch using w:0' , {
1220- metadata : { requires : { topology : [ 'single' , 'replicaset' , 'ssl' , 'heap' , 'wiredtiger' ] } } ,
1219+ it ( 'should correctly execute unordered batch using w:0' , async function ( ) {
1220+ await client . connect ( ) ;
1221+ const db = client . db ( ) ;
1222+ const col = db . collection ( 'batch_write_ordered_ops_9' ) ;
1223+ const bulk = col . initializeUnorderedBulkOp ( ) ;
1224+ for ( let i = 0 ; i < 100 ; i ++ ) {
1225+ bulk . insert ( { a : 1 } ) ;
1226+ }
12211227
1222- test : function ( done ) {
1223- client . connect ( ( err , client ) => {
1224- const db = client . db ( ) ;
1225- const col = db . collection ( 'batch_write_ordered_ops_9' ) ;
1226- const bulk = col . initializeUnorderedBulkOp ( ) ;
1227- for ( let i = 0 ; i < 100 ; i ++ ) {
1228- bulk . insert ( { a : 1 } ) ;
1229- }
1228+ bulk . find ( { b : 1 } ) . upsert ( ) . update ( { b : 1 } ) ;
1229+ bulk . find ( { c : 1 } ) . delete ( ) ;
12301230
1231- bulk . find ( { b : 1 } ) . upsert ( ) . update ( { b : 1 } ) ;
1232- bulk . find ( { c : 1 } ) . delete ( ) ;
1231+ const result = await bulk . execute ( { writeConcern : { w : 0 } } ) ;
1232+ test . equal ( 0 , result . upsertedCount ) ;
1233+ test . equal ( 0 , result . insertedCount ) ;
1234+ test . equal ( 0 , result . matchedCount ) ;
1235+ test . ok ( 0 === result . modifiedCount || result . modifiedCount == null ) ;
1236+ test . equal ( 0 , result . deletedCount ) ;
1237+ test . equal ( false , result . hasWriteErrors ( ) ) ;
12331238
1234- bulk . execute ( { writeConcern : { w : 0 } } , function ( err , result ) {
1235- expect ( err ) . to . not . exist ;
1236- test . equal ( 0 , result . upsertedCount ) ;
1237- test . equal ( 0 , result . insertedCount ) ;
1238- test . equal ( 0 , result . matchedCount ) ;
1239- test . ok ( 0 === result . modifiedCount || result . modifiedCount == null ) ;
1240- test . equal ( 0 , result . deletedCount ) ;
1241- test . equal ( false , result . hasWriteErrors ( ) ) ;
1242-
1243- client . close ( done ) ;
1244- } ) ;
1245- } ) ;
1246- }
1239+ await client . close ( ) ;
12471240 } ) ;
12481241
12491242 it ( 'should provide an accessor for operations on ordered bulk ops' , function ( done ) {
0 commit comments