Skip to content

Commit 73347be

Browse files
committed
remove pre-4.2 logic from change streams, aggregate, and server
1 parent 9e21008 commit 73347be

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/cursor/change_stream_cursor.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class ChangeStreamCursor<
9393
} else {
9494
options.resumeAfter = this.resumeToken;
9595
}
96-
} else if (this.startAtOperationTime != null && maxWireVersion(this.server) >= 7) {
96+
} else if (this.startAtOperationTime != null) {
9797
options.startAtOperationTime = this.startAtOperationTime;
9898
}
9999

@@ -145,8 +145,7 @@ export class ChangeStreamCursor<
145145
if (
146146
this.startAtOperationTime == null &&
147147
this.changeStreamCursorOptions.resumeAfter == null &&
148-
this.changeStreamCursorOptions.startAfter == null &&
149-
this.maxWireVersion >= 7
148+
this.changeStreamCursorOptions.startAfter == null
150149
) {
151150
this.startAtOperationTime = response.operationTime;
152151
}

src/operations/aggregate.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ import { CursorResponse, ExplainedCursorResponse } from '../cmap/wire_protocol/r
44
import { type CursorTimeoutMode } from '../cursor/abstract_cursor';
55
import { MongoInvalidArgumentError } from '../error';
66
import { type ExplainOptions } from '../explain';
7-
import { maxWireVersion, type MongoDBNamespace } from '../utils';
7+
import { type MongoDBNamespace } from '../utils';
88
import { WriteConcern } from '../write_concern';
99
import { type CollationOptions, CommandOperation, type CommandOperationOptions } from './command';
1010
import { Aspect, defineAspects, type Hint } from './operation';
1111

1212
/** @internal */
1313
export const DB_AGGREGATE_COLLECTION = 1 as const;
14-
const MIN_WIRE_VERSION_$OUT_READ_CONCERN_SUPPORT = 8;
1514

1615
/** @public */
1716
export interface AggregateOptions extends Omit<CommandOperationOptions, 'explain'> {
@@ -109,13 +108,8 @@ export class AggregateOperation extends CommandOperation<CursorResponse> {
109108

110109
override buildCommandDocument(connection: Connection): Document {
111110
const options = this.options;
112-
const serverWireVersion = maxWireVersion(connection);
113111
const command: Document = { aggregate: this.target, pipeline: this.pipeline };
114112

115-
if (this.hasWriteStage && serverWireVersion < MIN_WIRE_VERSION_$OUT_READ_CONCERN_SUPPORT) {
116-
this.readConcern = undefined;
117-
}
118-
119113
if (this.hasWriteStage && this.writeConcern) {
120114
WriteConcern.apply(command, this.writeConcern);
121115
}

src/sdam/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ export class Server extends TypedEventEmitter<ServerEvents> {
414414
} else {
415415
if (isSDAMUnrecoverableError(error)) {
416416
if (shouldHandleStateChangeError(this, error)) {
417-
const shouldClearPool = maxWireVersion(this) <= 7 || isNodeShuttingDownError(error);
417+
const shouldClearPool = isNodeShuttingDownError(error);
418418
if (this.loadBalanced && connection && shouldClearPool) {
419419
this.pool.clear({ serviceId: connection.serviceId });
420420
}

0 commit comments

Comments
 (0)