Skip to content

Commit 00eefd2

Browse files
committed
chore: fix filtering
1 parent 8c287de commit 00eefd2

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

test/integration/node-specific/client_close.test.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -744,18 +744,14 @@ describe('MongoClient.close() Integration', () => {
744744
const getCursors = async () => {
745745
const cursors = await utilClient
746746
.db('admin')
747-
.runCursorCommand({
748-
aggregate: 1,
749-
cursor: {},
750-
pipeline: [{ $currentOp: { idleCursors: true } }]
751-
})
747+
.aggregate([{ $currentOp: { idleCursors: true } }])
752748
.toArray();
753749

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-
];
750+
return cursors.filter(
751+
c =>
752+
c.ns !== 'local.oplog.rs' &&
753+
(c.type === 'idleCursor' || (c.type === 'op' && c.desc === 'getMore'))
754+
); // all idle cursors
759755
};
760756

761757
cursor = coll.find({}, { batchSize: 1 });

0 commit comments

Comments
 (0)