MCPcopy
hub / github.com/mongodb/node-mongodb-native / findSort

Function findSort

test/integration/crud/misc_cursors.test.ts:1638–1654  ·  view source on GitHub ↗
(input, output)

Source from the content-addressed store, hash-verified

1636
1637 context('sort', function () {
1638 const findSort = (input, output) =>
1639 async function () {
1640 const client = this.configuration.newClient({ monitorCommands: true });
1641 const events = [];
1642 client.on('commandStarted', event => {
1643 if (event.commandName === 'find') {
1644 events.push(event);
1645 }
1646 });
1647 const db = client.db('test');
1648 const collection = db.collection('test_sort_dos');
1649 const cursor = collection.find({}, { sort: input });
1650 await cursor.next();
1651 expect(events[0].command.sort).to.be.instanceOf(Map);
1652 expect(Array.from(events[0].command.sort)).to.deep.equal(Array.from(output));
1653 await client.close();
1654 };
1655
1656 const cursorSort = (input, output) =>
1657 async function () {

Callers 1

Calls 8

onMethod · 0.80
collectionMethod · 0.65
newClientMethod · 0.45
pushMethod · 0.45
dbMethod · 0.45
findMethod · 0.45
nextMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected