@@ -699,6 +699,12 @@ describe('MongoClient.close() Integration', () => {
699699 } ) ;
700700
701701 describe ( 'Server resource: Cursor' , ( ) => {
702+ const metadata : MongoDBMetadataUI = {
703+ requires : {
704+ mongodb : '>=4.2.0'
705+ }
706+ } ;
707+
702708 describe ( 'after cursors are created' , ( ) => {
703709 let client : MongoClient ;
704710 let coll : Collection ;
@@ -726,38 +732,42 @@ describe('MongoClient.close() Integration', () => {
726732 await cursor ?. close ( ) ;
727733 } ) ;
728734
729- it ( 'all active server-side cursors are closed by client.close()' , async function ( ) {
730- const getCursors = async ( ) => {
731- const res = await utilClient
732- . db ( )
733- . admin ( )
734- . command ( {
735- aggregate : 1 ,
736- cursor : { } ,
737- pipeline : [ { $currentOp : { idleCursors : true } } ]
738- } ) ;
739- return res . cursor . firstBatch . filter (
740- r => r . type === 'idleCursor' || ( r . type === 'op' && r . desc === 'getMore' )
741- ) ;
742- } ;
735+ it (
736+ 'all active server-side cursors are closed by client.close()' ,
737+ metadata ,
738+ async function ( ) {
739+ const getCursors = async ( ) => {
740+ const res = await utilClient
741+ . db ( )
742+ . admin ( )
743+ . command ( {
744+ aggregate : 1 ,
745+ cursor : { } ,
746+ pipeline : [ { $currentOp : { idleCursors : true } } ]
747+ } ) ;
748+ return res . cursor . firstBatch . filter (
749+ r => r . type === 'idleCursor' || ( r . type === 'op' && r . desc === 'getMore' )
750+ ) ;
751+ } ;
743752
744- cursor = coll . find (
745- { } ,
746- {
747- tailable : true ,
748- awaitData : true
749- }
750- ) ;
751- await cursor . next ( ) ;
753+ cursor = coll . find (
754+ { } ,
755+ {
756+ tailable : true ,
757+ awaitData : true
758+ }
759+ ) ;
760+ await cursor . next ( ) ;
752761
753- // assert creation
754- expect ( await getCursors ( ) ) . to . not . be . empty ;
762+ // assert creation
763+ expect ( await getCursors ( ) ) . to . not . be . empty ;
755764
756- await client . close ( ) ;
765+ await client . close ( ) ;
757766
758- // assert clean-up
759- expect ( await getCursors ( ) ) . to . be . empty ;
760- } ) ;
767+ // assert clean-up
768+ expect ( await getCursors ( ) ) . to . be . empty ;
769+ }
770+ ) ;
761771 } ) ;
762772 } ) ;
763773} ) ;
0 commit comments