@@ -455,15 +455,21 @@ describe('MongoClient.close() Integration', () => {
455455 let utilClient ;
456456 let session ;
457457
458- const metadata : MongoDBMetadataUI = { requires : { topology : [ 'replicaset' , 'sharded' ] } } ;
458+ const metadata : MongoDBMetadataUI = {
459+ requires : {
460+ topology : [ 'replicaset' , 'sharded' ] ,
461+ mongodb : '>=5.0' // currentOp requires 5.0 and above
462+ }
463+ } ;
459464
460465 beforeEach ( async function ( ) {
461466 client = this . configuration . newClient ( ) ;
462467 utilClient = this . configuration . newClient ( ) ;
463468 await client . connect ( ) ;
469+ const collection = client . db ( 'db' ) . collection ( 'collection' ) ;
464470 session = client . startSession ( { explicit : false } ) ;
465471 session . startTransaction ( ) ;
466- await client . db ( 'db' ) . collection ( 'collection' ) . insertOne ( { x : 1 } , { session } ) ;
472+ await collection . insertOne ( { x : 1 } , { session } ) ;
467473
468474 const opBefore = await utilClient . db ( ) . admin ( ) . command ( { currentOp : 1 } ) ;
469475 idleSessionsBeforeClose = opBefore . inprog . filter ( s => s . type === 'idleSession' ) ;
@@ -522,9 +528,10 @@ describe('MongoClient.close() Integration', () => {
522528 client = this . configuration . newClient ( ) ;
523529 utilClient = this . configuration . newClient ( ) ;
524530 await client . connect ( ) ;
531+ const collection = client . db ( 'db' ) . collection ( 'collection' ) ;
525532 session = client . startSession ( ) ;
526533 session . startTransaction ( ) ;
527- await client . db ( 'db' ) . collection ( 'collection' ) . insertOne ( { x : 1 } , { session } ) ;
534+ await collection . insertOne ( { x : 1 } , { session } ) ;
528535
529536 const opBefore = await utilClient . db ( ) . admin ( ) . command ( { currentOp : 1 } ) ;
530537 idleSessionsBeforeClose = opBefore . inprog . filter ( s => s . type === 'idleSession' ) ;
@@ -698,7 +705,7 @@ describe('MongoClient.close() Integration', () => {
698705 . admin ( )
699706 . command ( {
700707 aggregate : 1 ,
701- cursor : { batchSize : 10 } ,
708+ cursor : { } ,
702709 pipeline : [ { $currentOp : { idleCursors : true } } ]
703710 } ) ;
704711 return res . cursor . firstBatch . filter (
0 commit comments