File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
test/integration/node-specific Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -742,17 +742,20 @@ describe('MongoClient.close() Integration', () => {
742742 metadata ,
743743 async function ( ) {
744744 const getCursors = async ( ) => {
745- const res = await utilClient
746- . db ( )
747- . admin ( )
748- . command ( {
745+ const cursors = await utilClient
746+ . db ( 'admin' )
747+ . runCursorCommand ( {
749748 aggregate : 1 ,
750749 cursor : { } ,
751750 pipeline : [ { $currentOp : { idleCursors : true } } ]
752- } ) ;
753- return res . cursor . firstBatch . filter (
754- r => r . type === 'idleCursor' || ( r . type === 'op' && r . desc === 'getMore' )
755- ) ;
751+ } )
752+ . toArray ( ) ;
753+
754+ return [
755+ ...cursors . filter ( c => c . type === 'idleCursor' ) , // all idle cursors
756+ ...cursors . filter ( c => c . type === 'op' && c . desc === 'getMore' ) , // all running getMores
757+ ...cursors . filter ( c => c . ns !== 'local.oplog.rs' ) // no internal oplog cursors (sharded clusters)
758+ ] ;
756759 } ;
757760
758761 cursor = coll . find ( { } , { batchSize : 1 } ) ;
You can’t perform that action at this time.
0 commit comments