Skip to content

Commit 91b3948

Browse files
committed
review comments
1 parent 93746b7 commit 91b3948

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

src/cursor/abstract_cursor.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ export type InternalAbstractCursorOptions = Omit<AbstractCursorOptions, 'readPre
133133
partial?: boolean;
134134

135135
omitMaxTimeMS?: boolean;
136-
useMaxAwaitTimeMSAsMaxTimeMS?: boolean;
137136
};
138137

139138
/** @public */
@@ -237,9 +236,6 @@ export abstract class AbstractCursor<
237236
throw new MongoInvalidArgumentError('Cannot set timeoutMode without setting timeoutMS');
238237
}
239238

240-
this.cursorOptions.useMaxAwaitTimeMSAsMaxTimeMS =
241-
this.cursorOptions.tailable && this.cursorOptions.awaitData;
242-
243239
// Set for initial command
244240
this.cursorOptions.omitMaxTimeMS =
245241
this.cursorOptions.timeoutMS != null &&
@@ -790,7 +786,7 @@ export abstract class AbstractCursor<
790786
session: this.cursorSession,
791787
batchSize,
792788
omitMaxTimeMS:
793-
this.cursorOptions.omitMaxTimeMS || this.cursorOptions.useMaxAwaitTimeMSAsMaxTimeMS
789+
this.cursorOptions.omitMaxTimeMS
794790
};
795791

796792
if (
@@ -871,9 +867,6 @@ export abstract class AbstractCursor<
871867
// otherwise need to call getMore
872868
const batchSize = this.cursorOptions.batchSize || 1000;
873869
this.cursorOptions.omitMaxTimeMS = this.cursorOptions.timeoutMS != null;
874-
this.cursorOptions.useMaxAwaitTimeMSAsMaxTimeMS =
875-
this.cursorOptions.tailable && this.cursorOptions.awaitData;
876-
877870
try {
878871
const response = await this.getMore(batchSize);
879872
this.cursorId = response.id;

test/tools/unified-spec-runner/operations.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type RunOperationFn = (
4141
) => Promise<Document | boolean | number | null | void | string>;
4242
export const operations = new Map<string, RunOperationFn>();
4343

44-
export class MalformedOperationError extends AssertionError {}
44+
export class MalformedOperationError extends AssertionError { }
4545

4646
operations.set('createEntities', async ({ entities, operation, testConfig }) => {
4747
if (!operation.arguments?.entities) {
@@ -208,19 +208,19 @@ operations.set('close', async ({ entities, operation }) => {
208208
const timeoutMS = operation.arguments?.timeoutMS;
209209
await cursor.close({ timeoutMS });
210210
return;
211-
} catch {}
211+
} catch { }
212212

213213
try {
214214
const changeStream = entities.getEntity('stream', operation.object);
215215
await changeStream.close();
216216
return;
217-
} catch {}
217+
} catch { }
218218

219219
try {
220220
const client = entities.getEntity('client', operation.object);
221221
await client.close();
222222
return;
223-
} catch {}
223+
} catch { }
224224
/* eslint-enable no-empty */
225225

226226
throw new AssertionError(`No closable entity with key ${operation.object}`);
@@ -257,8 +257,8 @@ operations.set('createCollection', async ({ entities, operation }) => {
257257

258258
operations.set('createFindCursor', async ({ entities, operation }) => {
259259
const collection = entities.getEntity('collection', operation.object);
260-
const { filter, ...opts } = operation.arguments!;
261-
switch (opts.cursorType) {
260+
const { filter, cursorType, ...opts } = operation.arguments!;
261+
switch (cursorType) {
262262
case 'tailableAwait':
263263
opts.tailable = true;
264264
opts.awaitData = true;
@@ -269,7 +269,6 @@ operations.set('createFindCursor', async ({ entities, operation }) => {
269269
default:
270270
break;
271271
}
272-
delete opts.cursorType;
273272
const cursor = collection.find(filter, opts);
274273
// The spec dictates that we create the cursor and force the find command
275274
// to execute, but don't move the cursor forward. hasNext() accomplishes
@@ -333,8 +332,8 @@ operations.set('find', async ({ entities, operation }) => {
333332
} else {
334333
queryable = entities.getEntity('collection', operation.object);
335334
}
336-
const { filter, ...opts } = operation.arguments!;
337-
switch (opts.cursorType) {
335+
const { filter, cursorType, ...opts } = operation.arguments!;
336+
switch (cursorType) {
338337
case 'tailableAwait':
339338
opts.tailable = true;
340339
opts.awaitData = true;
@@ -345,7 +344,6 @@ operations.set('find', async ({ entities, operation }) => {
345344
default:
346345
break;
347346
}
348-
delete opts.cursorType;
349347
return queryable.find(filter, opts).toArray();
350348
});
351349

@@ -816,8 +814,8 @@ operations.set('runCursorCommand', async ({ entities, operation }: OperationFunc
816814

817815
operations.set('createCommandCursor', async ({ entities, operation }: OperationFunctionParams) => {
818816
const collection = entities.getEntity('db', operation.object);
819-
const { command, ...opts } = operation.arguments!;
820-
switch (opts.cursorType) {
817+
const { command, cursorType, ...opts } = operation.arguments!;
818+
switch (cursorType) {
821819
case 'tailableAwait':
822820
opts.tailable = true;
823821
opts.awaitData = true;
@@ -828,7 +826,6 @@ operations.set('createCommandCursor', async ({ entities, operation }: OperationF
828826
default:
829827
break;
830828
}
831-
delete opts.cursorType;
832829
const cursor = collection.runCursorCommand(command, {
833830
readPreference: ReadPreference.fromOptions({ readPreference: opts.readPreference }),
834831
session: opts.session,

0 commit comments

Comments
 (0)