@@ -699,6 +699,12 @@ describe('MongoClient.close() Integration', () => {
699
699
} ) ;
700
700
701
701
describe ( 'Server resource: Cursor' , ( ) => {
702
+ const metadata : MongoDBMetadataUI = {
703
+ requires : {
704
+ mongodb : '>=4.2.0'
705
+ }
706
+ } ;
707
+
702
708
describe ( 'after cursors are created' , ( ) => {
703
709
let client : MongoClient ;
704
710
let coll : Collection ;
@@ -726,38 +732,42 @@ describe('MongoClient.close() Integration', () => {
726
732
await cursor ?. close ( ) ;
727
733
} ) ;
728
734
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
+ } ;
743
752
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 ( ) ;
752
761
753
- // assert creation
754
- expect ( await getCursors ( ) ) . to . not . be . empty ;
762
+ // assert creation
763
+ expect ( await getCursors ( ) ) . to . not . be . empty ;
755
764
756
- await client . close ( ) ;
765
+ await client . close ( ) ;
757
766
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
+ ) ;
761
771
} ) ;
762
772
} ) ;
763
773
} ) ;
0 commit comments