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

Function operation

test/integration/crud/maxTimeMS.test.ts:158–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156
157 // Each test runs the same find operation, but asserts different outcomes
158 const operation = async () => {
159 cursor = cappedCollection.find({ _id: { $gt: 0 } }, { ...options, batchSize: 1 });
160 const findDocOrError: { _id: number } | Error = await cursor.next().catch(error => error);
161 const exhaustedByFind = !!cursor.id?.isZero();
162 const getMoreDocOrError: { _id: number } | Error | null = await cursor
163 .tryNext()
164 .catch(error => error);
165 expect(events).to.have.length.of.at.least(1); // At least find must be sent
166 return { findDocOrError, exhaustedByFind, getMoreDocOrError };
167 };
168
169 if (outcome.isFindError) {
170 it(`should error on find due to setting ${optionsString}`, metadata, async () => {

Callers 1

maxTimeMS.test.tsFile · 0.85

Calls 3

tryNextMethod · 0.80
findMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected