Skip to content

Commit 7ee694a

Browse files
committed
remove metadata and remove collection options
1 parent 88d1a9e commit 7ee694a

File tree

1 file changed

+22
-34
lines changed

1 file changed

+22
-34
lines changed

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

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -632,12 +632,6 @@ describe('MongoClient.close() Integration', () => {
632632
});
633633

634634
describe('Server resource: Cursor', () => {
635-
const metadata: MongoDBMetadataUI = {
636-
requires: {
637-
mongodb: '>=4.2.0'
638-
}
639-
};
640-
641635
describe('after cursors are created', () => {
642636
let client: MongoClient;
643637
let coll: Collection;
@@ -653,9 +647,7 @@ describe('MongoClient.close() Integration', () => {
653647
.collection('coll')
654648
.drop()
655649
.catch(() => null);
656-
coll = await client
657-
.db('db')
658-
.createCollection('coll', { capped: true, size: 1_000, max: 4 });
650+
coll = await client.db('db').createCollection('coll');
659651
await coll.insertMany([{ a: 1 }, { b: 2 }, { c: 3 }]);
660652
});
661653

@@ -665,35 +657,31 @@ describe('MongoClient.close() Integration', () => {
665657
await cursor?.close();
666658
});
667659

668-
it(
669-
'all active server-side cursors are closed by client.close()',
670-
metadata,
671-
async function () {
672-
const getCursors = async () => {
673-
const cursors = await utilClient
674-
.db('admin')
675-
.aggregate([{ $currentOp: { idleCursors: true } }])
676-
.toArray();
677-
678-
return cursors.filter(
679-
c =>
680-
c.ns !== 'local.oplog.rs' &&
681-
(c.type === 'idleCursor' || (c.type === 'op' && c.desc === 'getMore'))
682-
); // all idle cursors
683-
};
660+
it('all active server-side cursors are closed by client.close()', async function () {
661+
const getCursors = async () => {
662+
const cursors = await utilClient
663+
.db('admin')
664+
.aggregate([{ $currentOp: { idleCursors: true } }])
665+
.toArray();
666+
667+
return cursors.filter(
668+
c =>
669+
c.ns !== 'local.oplog.rs' &&
670+
(c.type === 'idleCursor' || (c.type === 'op' && c.desc === 'getMore'))
671+
); // all idle cursors
672+
};
684673

685-
cursor = coll.find({}, { batchSize: 1 });
686-
await cursor.next();
674+
cursor = coll.find({}, { batchSize: 1 });
675+
await cursor.next();
687676

688-
// assert creation
689-
expect(await getCursors()).to.not.be.empty;
677+
// assert creation
678+
expect(await getCursors()).to.not.be.empty;
690679

691-
await client.close();
680+
await client.close();
692681

693-
// assert clean-up
694-
expect(await getCursors()).to.be.empty;
695-
}
696-
);
682+
// assert clean-up
683+
expect(await getCursors()).to.be.empty;
684+
});
697685
});
698686
});
699687
});

0 commit comments

Comments
 (0)