77 type ChangeStream ,
88 ClientSession ,
99 type Collection ,
10- Long ,
1110 MongoClient ,
1211 MongoNotConnectedError ,
1312 ProfilingLevel ,
@@ -20,7 +19,7 @@ describe('When executing an operation for the first time', () => {
2019 let client : MongoClient ;
2120
2221 beforeEach ( 'create client' , async function ( ) {
23- client = this . configuration . newClient ( { } , { monitorCommands : true } ) ;
22+ client = this . configuration . newClient ( ) ;
2423 } ) ;
2524
2625 beforeEach ( 'create test namespace' , async function ( ) {
@@ -213,16 +212,13 @@ describe('When executing an operation for the first time', () => {
213212 let changeCausingCollection : Collection ;
214213 let collection : Collection ;
215214 let cs : ChangeStream ;
216- const cursors = [ ] ;
217215
218216 beforeEach ( async function ( ) {
219- cursors . length = 0 ;
220-
221217 if ( this . configuration . topologyType === TopologyType . Single ) {
222218 return ;
223219 }
224220 changeCausingClient = this . configuration . newClient ( ) ;
225- changeCausingCollection = await changeCausingClient
221+ await changeCausingClient
226222 . db ( 'auto-connect-change' )
227223 . createCollection ( 'auto-connect' )
228224 . catch ( ( ) => null ) ;
@@ -233,25 +229,9 @@ describe('When executing an operation for the first time', () => {
233229
234230 collection = client . db ( 'auto-connect-change' ) . collection ( 'auto-connect' ) ;
235231 cs = collection . watch ( ) ;
236-
237- client . on ( 'commandSucceeded' , ev => {
238- if ( ev . commandName === 'aggregate' ) {
239- const cursorId = Long . isLong ( ev . reply . cursor . id )
240- ? ev . reply . cursor . id
241- : Long . fromNumber ( ev . reply . cursor . id ) ;
242-
243- if ( ! Long . ZERO . equals ( cursorId ) ) {
244- cursors . push ( cursorId ) ;
245- }
246- }
247- } ) ;
248232 } ) ;
249233
250234 afterEach ( async function ( ) {
251- if ( cursors . length ) {
252- await client . db ( 'auto-connect-change' ) . command ( { killCursors : 'auto-connect' , cursors } ) ;
253- cursors . length = 0 ;
254- }
255235 await changeCausingClient ?. close ( ) ;
256236 await cs ?. close ( ) ;
257237 } ) ;
0 commit comments