@@ -382,8 +382,9 @@ exports['Should return an error when no operations in ordered batch'] = {
382
382
383
383
// The actual test we wish to run
384
384
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 ) ;
387
388
// Get the collection
388
389
var col = db . collection ( 'batch_write_ordered_ops_8' ) ;
389
390
@@ -392,7 +393,7 @@ exports['Should return an error when no operations in ordered batch'] = {
392
393
test . equal ( err instanceof Error , true ) ;
393
394
test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
394
395
395
- db . close ( ) ;
396
+ client . close ( ) ;
396
397
test . done ( ) ;
397
398
} ) ;
398
399
} ) ;
@@ -894,8 +895,9 @@ exports['Should return an error when no operations in unordered batch'] = {
894
895
895
896
// The actual test we wish to run
896
897
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 ) ;
899
901
// Get the collection
900
902
var col = db . collection ( 'batch_write_ordered_ops_8' ) ;
901
903
@@ -904,7 +906,7 @@ exports['Should return an error when no operations in unordered batch'] = {
904
906
test . equal ( err instanceof Error , true ) ;
905
907
test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
906
908
907
- db . close ( ) ;
909
+ client . close ( ) ;
908
910
test . done ( ) ;
909
911
} ) ;
910
912
} ) ;
@@ -1249,14 +1251,14 @@ exports['Should correctly handle bulk operation split for unordered bulk operati
1249
1251
1250
1252
exports [ 'Should return an error instead of throwing when no operations are provided for ordered bulk operation execute' ] = {
1251
1253
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 ) ;
1256
1258
db . collection ( 'doesnt_matter' ) . insertMany ( [ ] , function ( err , r ) {
1257
1259
test . equal ( err instanceof Error , true ) ;
1258
1260
test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
1259
- db . close ( ) ;
1261
+ client . close ( ) ;
1260
1262
test . done ( ) ;
1261
1263
} ) ;
1262
1264
} ) ;
@@ -1265,14 +1267,15 @@ exports['Should return an error instead of throwing when no operations are provi
1265
1267
1266
1268
exports [ 'Should return an error instead of throwing when no operations are provided for unordered bulk operation execute' ] = {
1267
1269
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 } ) ;
1270
1272
1271
- db . open ( function ( err , db ) {
1273
+ client . connect ( function ( err , client ) {
1274
+ var db = client . db ( configuration . database ) ;
1272
1275
db . collection ( 'doesnt_matter' ) . insertMany ( [ ] , { ordered : false } , function ( err , r ) {
1273
1276
test . equal ( err instanceof Error , true ) ;
1274
1277
test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
1275
- db . close ( ) ;
1278
+ client . close ( ) ;
1276
1279
test . done ( ) ;
1277
1280
} ) ;
1278
1281
} ) ;
@@ -1281,11 +1284,14 @@ exports['Should return an error instead of throwing when no operations are provi
1281
1284
1282
1285
exports [ 'Should return an error instead of throwing when an empty bulk operation is submitted (with promise)' ] = {
1283
1286
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 } ) ;
1286
1289
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
+ } )
1289
1295
. then ( function ( ) {
1290
1296
test . equal ( false , true ) ; // this should not happen!
1291
1297
} )
@@ -1294,7 +1300,7 @@ exports['Should return an error instead of throwing when an empty bulk operation
1294
1300
test . equal ( err . message , 'Invalid Operation, no operations specified' ) ;
1295
1301
} )
1296
1302
. then ( function ( ) {
1297
- db . close ( ) ;
1303
+ client . close ( ) ;
1298
1304
test . done ( ) ;
1299
1305
} ) ;
1300
1306
}
0 commit comments