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

Function test

test/integration/crud/misc_cursors.test.ts:133–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131 it('should correctly execute cursor count with secondary readPreference', {
132 metadata: { requires: { topology: 'replicaset' } },
133 async test() {
134 const bag = [];
135 client.on('commandStarted', filterForCommands(['count'], bag));
136
137 const cursor = client
138 .db()
139 .collection('countTEST')
140 .find({ qty: { $gt: 4 } });
141 await cursor.count({ readPreference: ReadPreference.SECONDARY });
142
143 const selectedServerAddress = bag[0].address
144 .replace('127.0.0.1', 'localhost')
145 .replace('[::1]', 'localhost');
146 const selectedServer = client.topology.description.servers.get(selectedServerAddress);
147 expect(selectedServer).property('type').to.equal(ServerType.RSSecondary);
148 }
149 });
150
151 it('shouldThrowErrorOnEachWhenMissingCallback', {

Callers

nothing calls this directly

Calls 12

filterForCommandsFunction · 0.90
runLaterFunction · 0.90
onMethod · 0.80
insertOneMethod · 0.80
collectionMethod · 0.65
findMethod · 0.45
dbMethod · 0.45
countMethod · 0.45
getMethod · 0.45
dropMethod · 0.45
createCollectionMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected