@@ -382,8 +382,9 @@ exports['Should return an error when no operations in ordered batch'] = {
382382
383383 // The actual test we wish to run
384384 test : function ( configuration , test ) {
385- var db = configuration . newDbInstance ( { w :1 } , { poolSize :1 , auto_reconnect :false } ) ;
386- db . open ( function ( err , db ) {
385+ var client = configuration . newDbInstance ( { w :1 } , { poolSize :1 , auto_reconnect :false } ) ;
386+ client . connect ( function ( err , client ) {
387+ var db = client . db ( configuration . database ) ;
387388 // Get the collection
388389 var col = db . collection ( 'batch_write_ordered_ops_8' ) ;
389390
@@ -392,7 +393,7 @@ exports['Should return an error when no operations in ordered batch'] = {
392393 test . equal ( err instanceof Error , true ) ;
393394 test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
394395
395- db . close ( ) ;
396+ client . close ( ) ;
396397 test . done ( ) ;
397398 } ) ;
398399 } ) ;
@@ -894,8 +895,9 @@ exports['Should return an error when no operations in unordered batch'] = {
894895
895896 // The actual test we wish to run
896897 test : function ( configuration , test ) {
897- var db = configuration . newDbInstance ( { w :1 } , { poolSize :1 , auto_reconnect :false } ) ;
898- db . open ( function ( err , db ) {
898+ var client = configuration . newDbInstance ( { w :1 } , { poolSize :1 , auto_reconnect :false } ) ;
899+ client . connect ( function ( err , client ) {
900+ var db = client . db ( configuration . database ) ;
899901 // Get the collection
900902 var col = db . collection ( 'batch_write_ordered_ops_8' ) ;
901903
@@ -904,7 +906,7 @@ exports['Should return an error when no operations in unordered batch'] = {
904906 test . equal ( err instanceof Error , true ) ;
905907 test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
906908
907- db . close ( ) ;
909+ client . close ( ) ;
908910 test . done ( ) ;
909911 } ) ;
910912 } ) ;
@@ -1249,14 +1251,14 @@ exports['Should correctly handle bulk operation split for unordered bulk operati
12491251
12501252exports [ 'Should return an error instead of throwing when no operations are provided for ordered bulk operation execute' ] = {
12511253 metadata : { requires : { mongodb : ">=2.6.0" , topology : 'single' , node : ">0.10.0" } } ,
1252- test : function ( configure , test ) {
1253- var db = configure . newDbInstance ( { w : 1 } , { poolSize : 1 } ) ;
1254-
1255- db . open ( function ( err , db ) {
1254+ test : function ( configuration , test ) {
1255+ var client = configuration . newDbInstance ( { w : 1 } , { poolSize : 1 } ) ;
1256+ client . connect ( function ( err , client ) {
1257+ var db = client . db ( configuration . database ) ;
12561258 db . collection ( 'doesnt_matter' ) . insertMany ( [ ] , function ( err , r ) {
12571259 test . equal ( err instanceof Error , true ) ;
12581260 test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
1259- db . close ( ) ;
1261+ client . close ( ) ;
12601262 test . done ( ) ;
12611263 } ) ;
12621264 } ) ;
@@ -1265,14 +1267,15 @@ exports['Should return an error instead of throwing when no operations are provi
12651267
12661268exports [ 'Should return an error instead of throwing when no operations are provided for unordered bulk operation execute' ] = {
12671269 metadata : { requires : { mongodb : ">=2.6.0" , topology : 'single' , node : ">0.10.0" } } ,
1268- test : function ( configure , test ) {
1269- var db = configure . newDbInstance ( { w : 1 } , { poolSize : 1 } ) ;
1270+ test : function ( configuration , test ) {
1271+ var client = configuration . newDbInstance ( { w : 1 } , { poolSize : 1 } ) ;
12701272
1271- db . open ( function ( err , db ) {
1273+ client . connect ( function ( err , client ) {
1274+ var db = client . db ( configuration . database ) ;
12721275 db . collection ( 'doesnt_matter' ) . insertMany ( [ ] , { ordered : false } , function ( err , r ) {
12731276 test . equal ( err instanceof Error , true ) ;
12741277 test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
1275- db . close ( ) ;
1278+ client . close ( ) ;
12761279 test . done ( ) ;
12771280 } ) ;
12781281 } ) ;
@@ -1281,11 +1284,14 @@ exports['Should return an error instead of throwing when no operations are provi
12811284
12821285exports [ 'Should return an error instead of throwing when an empty bulk operation is submitted (with promise)' ] = {
12831286 metadata : { requires : { promises : true , node : ">0.12.0" } } ,
1284- test : function ( configure , test ) {
1285- var db = configure . newDbInstance ( { w : 1 } , { poolSize : 1 } ) ;
1287+ test : function ( configuration , test ) {
1288+ var client = configuration . newDbInstance ( { w : 1 } , { poolSize : 1 } ) ;
12861289
1287- return db . open ( )
1288- . then ( function ( ) { return db . collection ( 'doesnt_matter' ) . insertMany ( [ ] ) ; } )
1290+ return client . connect ( )
1291+ . then ( function ( ) {
1292+ var db = client . db ( configuration . database ) ;
1293+ return db . collection ( 'doesnt_matter' ) . insertMany ( [ ] ) ;
1294+ } )
12891295 . then ( function ( ) {
12901296 test . equal ( false , true ) ; // this should not happen!
12911297 } )
@@ -1294,7 +1300,7 @@ exports['Should return an error instead of throwing when an empty bulk operation
12941300 test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
12951301 } )
12961302 . then ( function ( ) {
1297- db . close ( ) ;
1303+ client . close ( ) ;
12981304 test . done ( ) ;
12991305 } ) ;
13001306 }
0 commit comments