From fe62f1378aa24105fcb43869bfbe10ca03e2ae42 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 3 Jul 2026 15:34:22 -0400 Subject: [PATCH 01/38] chore: bump minWireVersion -> 9 && server to 4.4 --- src/cmap/wire_protocol/constants.ts | 4 +- .../unit/cmap/wire_protocol/constants.test.ts | 4 +- test/unit/error.test.ts | 58 +------------------ 3 files changed, 6 insertions(+), 60 deletions(-) diff --git a/src/cmap/wire_protocol/constants.ts b/src/cmap/wire_protocol/constants.ts index aa689033e18..108b9fe4cdf 100644 --- a/src/cmap/wire_protocol/constants.ts +++ b/src/cmap/wire_protocol/constants.ts @@ -1,8 +1,8 @@ -export const MIN_SUPPORTED_SERVER_VERSION = '4.2'; +export const MIN_SUPPORTED_SERVER_VERSION = '4.4'; export const MAX_SUPPORTED_SERVER_VERSION = '9.0'; export const MIN_SUPPORTED_SNAPSHOT_READS_WIRE_VERSION = 13; export const MIN_SUPPORTED_SNAPSHOT_READS_SERVER_VERSION = '5.0'; -export const MIN_SUPPORTED_WIRE_VERSION = 8; +export const MIN_SUPPORTED_WIRE_VERSION = 9; export const MAX_SUPPORTED_WIRE_VERSION = 29; export const MIN_SUPPORTED_QE_WIRE_VERSION = 21; export const MIN_SUPPORTED_QE_SERVER_VERSION = '7.0'; diff --git a/test/unit/cmap/wire_protocol/constants.test.ts b/test/unit/cmap/wire_protocol/constants.test.ts index 1ca468c0c06..d659788625f 100644 --- a/test/unit/cmap/wire_protocol/constants.test.ts +++ b/test/unit/cmap/wire_protocol/constants.test.ts @@ -9,8 +9,8 @@ import { describe('Wire Protocol Constants', function () { describe('MIN_SUPPORTED_SERVER_VERSION', function () { - it('returns 4.2', function () { - expect(MIN_SUPPORTED_SERVER_VERSION).to.equal('4.2'); + it('returns 4.4', function () { + expect(MIN_SUPPORTED_SERVER_VERSION).to.equal('4.4'); }); }); diff --git a/test/unit/error.test.ts b/test/unit/error.test.ts index 5315dcdea2d..3dab63fd02a 100644 --- a/test/unit/error.test.ts +++ b/test/unit/error.test.ts @@ -460,7 +460,6 @@ describe('MongoErrors', () => { // 9 - above server version 4.4 const ABOVE_4_4 = 9; - const BELOW_4_4 = 8; const tests: { description: string; @@ -468,36 +467,6 @@ describe('MongoErrors', () => { error: Error; maxWireVersion: number; }[] = [ - { - description: 'a plain error', - result: false, - error: new Error('do not retry me!'), - maxWireVersion: BELOW_4_4 - }, - { - description: 'a MongoError with no code nor label', - result: false, - error: new MongoError('do not retry me!'), - maxWireVersion: BELOW_4_4 - }, - { - description: 'network error', - result: true, - error: new MongoNetworkError('socket bad, try again'), - maxWireVersion: BELOW_4_4 - }, - { - description: 'a MongoWriteConcernError with a random label', - result: false, - error: new MongoWriteConcernError({ - writeConcernError: { - errmsg: 'random label', - code: 1 - }, - errorLabels: ['myLabel'] - }), - maxWireVersion: BELOW_4_4 - }, { description: 'a MongoWriteConcernError with a retryable code above server 4.4', result: false, @@ -509,29 +478,6 @@ describe('MongoErrors', () => { }), maxWireVersion: ABOVE_4_4 }, - { - description: 'a MongoWriteConcernError with a retryable code below server 4.4', - result: true, - error: new MongoWriteConcernError({ - writeConcernError: { - errmsg: 'code 262', - code: 262 - } - }), - maxWireVersion: BELOW_4_4 - }, - { - description: 'a MongoWriteConcernError with a RetryableWriteError label below server 4.4', - result: false, - error: new MongoWriteConcernError({ - writeConcernError: { - errmsg: 'code 1', - code: 1 - }, - errorLabels: ['RetryableWriteError'] - }), - maxWireVersion: BELOW_4_4 - }, { description: 'a MongoWriteConcernError with a RetryableWriteError label above server 4.4', result: false, @@ -557,9 +503,9 @@ describe('MongoErrors', () => { maxWireVersion: ABOVE_4_4 } ]; - for (const { description, result, error, maxWireVersion } of tests) { + for (const { description, result, error } of tests) { it(`${description} ${result ? 'needs' : 'does not need'} a retryable write label`, () => { - expect(needsRetryableWriteLabel(error, maxWireVersion)).to.be.equal(result); + expect(needsRetryableWriteLabel(error)).to.be.equal(result); }); } }); From b077346655d45bc75b7d4749f23cb3c1852300c9 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 3 Jul 2026 15:35:03 -0400 Subject: [PATCH 02/38] refactor: -unreachables, -unused --- src/cmap/auth/mongodb_aws.ts | 14 ++------------ src/cmap/connect.ts | 2 +- src/error.ts | 17 ++--------------- src/operations/delete.ts | 15 +++------------ src/operations/find_and_modify.ts | 6 +++--- src/operations/get_more.ts | 6 +++--- src/operations/indexes.ts | 10 +--------- src/operations/list_collections.ts | 5 ++--- src/operations/list_databases.ts | 6 +++--- src/sdam/server.ts | 2 +- src/utils.ts | 4 +--- 11 files changed, 22 insertions(+), 65 deletions(-) diff --git a/src/cmap/auth/mongodb_aws.ts b/src/cmap/auth/mongodb_aws.ts index 422beb3dbd2..56c1fca74d2 100644 --- a/src/cmap/auth/mongodb_aws.ts +++ b/src/cmap/auth/mongodb_aws.ts @@ -1,11 +1,7 @@ import { type Binary, type BSONSerializeOptions, ByteUtils } from '../../bson'; import * as BSON from '../../bson'; -import { - MongoCompatibilityError, - MongoMissingCredentialsError, - MongoRuntimeError -} from '../../error'; -import { maxWireVersion, ns, randomBytes } from '../../utils'; +import { MongoMissingCredentialsError, MongoRuntimeError } from '../../error'; +import { ns, randomBytes } from '../../utils'; import { type AuthContext, AuthProvider } from './auth_provider'; import { type AWSCredentialProvider, @@ -45,12 +41,6 @@ export class MongoDBAWS extends AuthProvider { throw new MongoMissingCredentialsError('AuthContext must provide credentials.'); } - if (maxWireVersion(connection) < 9) { - throw new MongoCompatibilityError( - 'MONGODB-AWS authentication requires MongoDB version 4.4 or later' - ); - } - authContext.credentials = await makeTempCredentials( authContext.credentials, this.credentialFetcher diff --git a/src/cmap/connect.ts b/src/cmap/connect.ts index 35d3d622f9c..5b6349affeb 100644 --- a/src/cmap/connect.ts +++ b/src/cmap/connect.ts @@ -174,7 +174,7 @@ export async function performInitialHandshake( if (error instanceof MongoError) { error.addErrorLabel(MongoErrorLabel.HandshakeError); - if (needsRetryableWriteLabel(error, response.maxWireVersion, conn.description.type)) { + if (needsRetryableWriteLabel(error)) { error.addErrorLabel(MongoErrorLabel.RetryableWriteError); } } diff --git a/src/error.ts b/src/error.ts index e17e3e71ebb..e442fefd86d 100644 --- a/src/error.ts +++ b/src/error.ts @@ -3,7 +3,6 @@ import { type ClientBulkWriteError, type ClientBulkWriteResult } from './operations/client_bulk_write/common'; -import type { ServerType } from './sdam/common'; import type { TopologyVersion } from './sdam/server_description'; import type { TopologyDescription } from './sdam/topology_description'; @@ -1394,22 +1393,14 @@ const RETRYABLE_READ_ERROR_CODES = new Set([ // see: https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.md#terms const RETRYABLE_WRITE_ERROR_CODES = RETRYABLE_READ_ERROR_CODES; -export function needsRetryableWriteLabel( - error: Error, - maxWireVersion: number, - serverType: ServerType -): boolean { +export function needsRetryableWriteLabel(error: Error): boolean { // pre-4.4 server, then the driver adds an error label for every valid case // execute operation will only inspect the label, code/message logic is handled here if (error instanceof MongoNetworkError) { return true; } - if (error instanceof MongoError) { - if ( - (maxWireVersion >= 9 || isRetryableWriteError(error)) && - !error.hasErrorLabel(MongoErrorLabel.HandshakeError) - ) { + if (isRetryableWriteError(error) && !error.hasErrorLabel(MongoErrorLabel.HandshakeError)) { // If we already have the error label no need to add it again. 4.4+ servers add the label. // In the case where we have a handshake error, need to fall down to the logic checking // the codes. @@ -1418,10 +1409,6 @@ export function needsRetryableWriteLabel( } if (error instanceof MongoWriteConcernError) { - if (serverType === 'Mongos' && maxWireVersion < 9) { - // use original top-level code from server response - return RETRYABLE_WRITE_ERROR_CODES.has(error.result.code ?? 0); - } const code = error.result.writeConcernError.code ?? Number(error.code); return RETRYABLE_WRITE_ERROR_CODES.has(Number.isNaN(code) ? 0 : code); } diff --git a/src/operations/delete.ts b/src/operations/delete.ts index 94b6435e1bb..0141b5ce644 100644 --- a/src/operations/delete.ts +++ b/src/operations/delete.ts @@ -1,9 +1,9 @@ import type { Document } from '../bson'; import { type Connection } from '../cmap/connection'; import { MongoDBResponse } from '../cmap/wire_protocol/responses'; -import { MongoCompatibilityError, MongoServerError } from '../error'; +import { MongoServerError } from '../error'; import type { ClientSession } from '../sessions'; -import { maxWireVersion, type MongoDBCollectionNamespace, type MongoDBNamespace } from '../utils'; +import { type MongoDBCollectionNamespace, type MongoDBNamespace } from '../utils'; import { type WriteConcernOptions } from '../write_concern'; import { type CollationOptions, CommandOperation, type CommandOperationOptions } from './command'; import { Aspect, defineAspects, type Hint } from './operation'; @@ -65,7 +65,7 @@ export class DeleteOperation extends CommandOperation { return this.statements.every(op => (op.limit != null ? op.limit > 0 : true)); } - override buildCommandDocument(connection: Connection, _session?: ClientSession): Document { + override buildCommandDocument(_connection: Connection, _session?: ClientSession): Document { const options = this.options; const ordered = typeof options.ordered === 'boolean' ? options.ordered : true; @@ -85,15 +85,6 @@ export class DeleteOperation extends CommandOperation { command.comment = options.comment; } - const unacknowledgedWrite = this.writeConcern && this.writeConcern.w === 0; - if (unacknowledgedWrite && maxWireVersion(connection) < 9) { - if (this.statements.find((o: Document) => o.hint)) { - throw new MongoCompatibilityError( - `hint for the delete command is only supported on MongoDB 4.4+` - ); - } - } - return command; } } diff --git a/src/operations/find_and_modify.ts b/src/operations/find_and_modify.ts index a35e288dd47..e4fd97164c2 100644 --- a/src/operations/find_and_modify.ts +++ b/src/operations/find_and_modify.ts @@ -6,7 +6,7 @@ import { MongoCompatibilityError, MongoInvalidArgumentError } from '../error'; import { ReadPreference } from '../read_preference'; import type { ClientSession } from '../sessions'; import { formatSort, type Sort, type SortForCmd } from '../sort'; -import { decorateWithCollation, hasAtomicOperators, maxWireVersion } from '../utils'; +import { decorateWithCollation, hasAtomicOperators } from '../utils'; import { type WriteConcern, type WriteConcernSettings } from '../write_concern'; import { CommandOperation, type CommandOperationOptions } from './command'; import { Aspect, defineAspects } from './operation'; @@ -146,7 +146,7 @@ export class FindAndModifyOperation extends CommandOperation { } override buildCommandDocument( - connection: Connection, + _connection: Connection, _session?: ClientSession ): Document & FindAndModifyCmdBase { const options = this.options; @@ -192,7 +192,7 @@ export class FindAndModifyOperation extends CommandOperation { if (options.hint) { const unacknowledgedWrite = this.writeConcern?.w === 0; - if (unacknowledgedWrite && maxWireVersion(connection) < 9) { + if (unacknowledgedWrite) { throw new MongoCompatibilityError( 'hint for the findAndModify command is only supported on MongoDB 4.4+' ); diff --git a/src/operations/get_more.ts b/src/operations/get_more.ts index 4e94020cd7e..bdfcb458c62 100644 --- a/src/operations/get_more.ts +++ b/src/operations/get_more.ts @@ -4,7 +4,7 @@ import { CursorResponse } from '../cmap/wire_protocol/responses'; import { MongoRuntimeError } from '../error'; import type { Server, ServerCommandOptions } from '../sdam/server'; import { type TimeoutContext } from '../timeout'; -import { maxWireVersion, type MongoDBNamespace } from '../utils'; +import { type MongoDBNamespace } from '../utils'; import { AbstractOperation, Aspect, defineAspects, type OperationOptions } from './operation'; /** @internal */ @@ -55,7 +55,7 @@ export class GetMoreOperation extends AbstractOperation { return 'getMore' as const; } - override buildCommand(connection: Connection): Document { + override buildCommand(_connection: Connection): Document { if (this.cursorId == null || this.cursorId.isZero()) { throw new MongoRuntimeError('Unable to iterate cursor with no id'); } @@ -82,7 +82,7 @@ export class GetMoreOperation extends AbstractOperation { // we check for undefined specifically here to allow falsy values // eslint-disable-next-line no-restricted-syntax - if (this.options.comment !== undefined && maxWireVersion(connection) >= 9) { + if (this.options.comment !== undefined) { getMoreCmd.comment = this.options.comment; } diff --git a/src/operations/indexes.ts b/src/operations/indexes.ts index f6354dcf1ad..ea4173f66b2 100644 --- a/src/operations/indexes.ts +++ b/src/operations/indexes.ts @@ -3,7 +3,6 @@ import { type Connection } from '../cmap/connection'; import { CursorResponse, MongoDBResponse } from '../cmap/wire_protocol/responses'; import type { Collection } from '../collection'; import { type AbstractCursorOptions } from '../cursor/abstract_cursor'; -import { MongoCompatibilityError } from '../error'; import { type OneOrMore } from '../mongo_types'; import { isObject, maxWireVersion, type MongoDBNamespace } from '../utils'; import { @@ -299,20 +298,13 @@ export class CreateIndexesOperation extends CommandOperation { return 'createIndexes'; } - override buildCommandDocument(connection: Connection): Document { + override buildCommandDocument(_connection: Connection): Document { const options = this.options; const indexes = this.indexes; - const serverWireVersion = maxWireVersion(connection); - const cmd: Document = { createIndexes: this.collectionName, indexes }; if (options.commitQuorum != null) { - if (serverWireVersion < 9) { - throw new MongoCompatibilityError( - 'Option `commitQuorum` for `createIndexes` not supported on servers < 4.4' - ); - } cmd.commitQuorum = options.commitQuorum; } return cmd; diff --git a/src/operations/list_collections.ts b/src/operations/list_collections.ts index df38c954cb9..b829af4e9b0 100644 --- a/src/operations/list_collections.ts +++ b/src/operations/list_collections.ts @@ -4,7 +4,6 @@ import { CursorResponse, ExplainedCursorResponse } from '../cmap/wire_protocol/r import { type CursorTimeoutContext, type CursorTimeoutMode } from '../cursor/abstract_cursor'; import type { Db } from '../db'; import { type Abortable } from '../mongo_types'; -import { maxWireVersion } from '../utils'; import { CommandOperation, type CommandOperationOptions } from './command'; import { Aspect, defineAspects } from './operation'; @@ -63,7 +62,7 @@ export class ListCollectionsOperation extends CommandOperation { return 'listCollections' as const; } - override buildCommandDocument(connection: Connection): Document { + override buildCommandDocument(_connection: Connection): Document { const command: Document = { listCollections: 1, filter: this.filter, @@ -74,7 +73,7 @@ export class ListCollectionsOperation extends CommandOperation { // we check for undefined specifically here to allow falsy values // eslint-disable-next-line no-restricted-syntax - if (maxWireVersion(connection) >= 9 && this.options.comment !== undefined) { + if (this.options.comment !== undefined) { command.comment = this.options.comment; } diff --git a/src/operations/list_databases.ts b/src/operations/list_databases.ts index b9f4e97dda7..1867471a6cb 100644 --- a/src/operations/list_databases.ts +++ b/src/operations/list_databases.ts @@ -3,7 +3,7 @@ import type { Document } from '../bson'; import { MongoDBResponse } from '../cmap/wire_protocol/responses'; import type { Db } from '../db'; import type { ClientSession } from '../sessions'; -import { maxWireVersion, MongoDBNamespace } from '../utils'; +import { MongoDBNamespace } from '../utils'; import { CommandOperation, type CommandOperationOptions } from './command'; import { Aspect, defineAspects } from './operation'; @@ -40,7 +40,7 @@ export class ListDatabasesOperation extends CommandOperation= 9 && this.options.comment !== undefined) { + if (this.options.comment !== undefined) { cmd.comment = this.options.comment; } diff --git a/src/sdam/server.ts b/src/sdam/server.ts index 14b6455f1f1..45c1c4127e2 100644 --- a/src/sdam/server.ts +++ b/src/sdam/server.ts @@ -494,7 +494,7 @@ export class Server extends TypedEventEmitter { } else { if ( (isRetryableWritesEnabled(this.topology) || isTransactionCommand(cmd)) && - needsRetryableWriteLabel(error, maxWireVersion(this), this.description.type) && + needsRetryableWriteLabel(error) && !inActiveTransaction(session, cmd) ) { error.addErrorLabel(MongoErrorLabel.RetryableWriteError); diff --git a/src/utils.ts b/src/utils.ts index 50c0ddf0a20..d9a96115fc8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -343,9 +343,7 @@ export function maxWireVersion(handshakeAware?: Connection | Topology | Server): // object being checked will be a connection, and we will have a hello response on // it. For other cases, such as retryable writes, the object will be a server or // topology, and there will be no hello response on those objects, so we return - // the max wire version so we support retryability. Once we have a min supported - // wire version of 9, then the needsRetryableWriteLabel() check can remove the - // usage of passing the wire version into it. + // the max wire version so we support retryability. if (handshakeAware.loadBalanced) { return MAX_SUPPORTED_WIRE_VERSION; } From 531b09c0a900d07e98571e09cfdaa855bbb93c92 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 3 Jul 2026 16:07:37 -0400 Subject: [PATCH 03/38] test: -4.2envs --- .evergreen/config.yml | 231 ------------------------------------------ 1 file changed, 231 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index f48d61f0229..02a6bde0c00 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1330,54 +1330,6 @@ tasks: - func: install dependencies - func: bootstrap mongo-orchestration - func: run tests - - name: test-4.2-server - tags: - - '4.2' - - server - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: server} - - {key: SSL, value: nossl} - - {key: AUTH, value: auth} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - - name: test-4.2-replica_set - tags: - - '4.2' - - replica_set - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: replica_set} - - {key: SSL, value: nossl} - - {key: AUTH, value: auth} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - - name: test-4.2-sharded_cluster - tags: - - '4.2' - - sharded_cluster - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: sharded_cluster} - - {key: SSL, value: nossl} - - {key: AUTH, value: auth} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - name: test-latest-server-v1-api tags: - latest @@ -1733,22 +1685,6 @@ tasks: - func: install dependencies - func: bootstrap mongo-orchestration - func: run tls tests - - name: test-tls-support-4.2 - tags: - - tls-support - - tls-support-4.2 - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: SSL, value: ssl} - - {key: TOPOLOGY, value: server} - - {key: AUTH, value: auth} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tls tests - name: aws-latest-auth-test-run-aws-auth-test-with-regular-aws-credentials commands: - command: expansions.update @@ -2535,60 +2471,6 @@ tasks: - func: install dependencies - func: bootstrap mongo-orchestration - func: run tests - - name: test-4.2-server-noauth - tags: - - '4.2' - - server - - noauth - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: server} - - {key: AUTH, value: noauth} - - {key: SSL, value: nossl} - - {key: NODE_LTS_VERSION, value: 20.19.0} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - - name: test-4.2-replica_set-noauth - tags: - - '4.2' - - replica_set - - noauth - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: replica_set} - - {key: AUTH, value: noauth} - - {key: SSL, value: nossl} - - {key: NODE_LTS_VERSION, value: 20.19.0} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - - name: test-4.2-sharded_cluster-noauth - tags: - - '4.2' - - sharded_cluster - - noauth - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: sharded_cluster} - - {key: AUTH, value: noauth} - - {key: SSL, value: nossl} - - {key: NODE_LTS_VERSION, value: 20.19.0} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - name: test-lambda-example tags: - latest @@ -2734,22 +2616,6 @@ tasks: - func: install dependencies - func: bootstrap mongo-orchestration - func: run tests - - name: test-4.2-csfle-mongocryptd - tags: - - '4.2' - - sharded_cluster - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: sharded_cluster} - - {key: AUTH, value: auth} - - {key: NODE_LTS_VERSION, value: '24'} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - name: test-latest-server-ssl tags: - latest @@ -3170,66 +3036,6 @@ tasks: - func: install dependencies - func: bootstrap mongo-orchestration - func: run tests - - name: test-4.2-server-ssl - tags: - - '4.2' - - server - - ssl - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: server} - - {key: AUTH, value: auth} - - {key: SSL, value: ssl} - - {key: NODE_LTS_VERSION, value: '24'} - - {key: CLIENT_ENCRYPTION, value: 'true'} - - {key: TEST_CSFLE, value: 'true'} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - - name: test-4.2-replica_set-ssl - tags: - - '4.2' - - replica_set - - ssl - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: replica_set} - - {key: AUTH, value: auth} - - {key: SSL, value: ssl} - - {key: NODE_LTS_VERSION, value: '24'} - - {key: CLIENT_ENCRYPTION, value: 'true'} - - {key: TEST_CSFLE, value: 'true'} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests - - name: test-4.2-sharded_cluster-ssl - tags: - - '4.2' - - sharded_cluster - - ssl - commands: - - command: expansions.update - type: setup - params: - updates: - - {key: VERSION, value: '4.2'} - - {key: TOPOLOGY, value: sharded_cluster} - - {key: AUTH, value: auth} - - {key: SSL, value: ssl} - - {key: NODE_LTS_VERSION, value: '24'} - - {key: CLIENT_ENCRYPTION, value: 'true'} - - {key: TEST_CSFLE, value: 'true'} - - func: install dependencies - - func: bootstrap mongo-orchestration - - func: run tests task_groups: - name: test_gcpkms_task_group setup_group_can_fail_task: true @@ -3537,9 +3343,6 @@ buildvariants: - test-4.4-server - test-4.4-replica_set - test-4.4-sharded_cluster - - test-4.2-server - - test-4.2-replica_set - - test-4.2-sharded_cluster - test-latest-server-v1-api - test-x509-authentication - test-atlas-connectivity @@ -3562,7 +3365,6 @@ buildvariants: - test-tls-support-6.0 - test-tls-support-5.0 - test-tls-support-4.4 - - test-tls-support-4.2 - name: rhel80-large-Node22 display_name: rhel8 Node22 run_on: rhel80-large @@ -3592,9 +3394,6 @@ buildvariants: - test-4.4-server - test-4.4-replica_set - test-4.4-sharded_cluster - - test-4.2-server - - test-4.2-replica_set - - test-4.2-sharded_cluster - test-latest-server-v1-api - test-x509-authentication - test-atlas-connectivity @@ -3617,7 +3416,6 @@ buildvariants: - test-tls-support-6.0 - test-tls-support-5.0 - test-tls-support-4.4 - - test-tls-support-4.2 - name: rhel80-large-Node24 display_name: rhel8 Node24 run_on: rhel80-large @@ -3647,9 +3445,6 @@ buildvariants: - test-4.4-server - test-4.4-replica_set - test-4.4-sharded_cluster - - test-4.2-server - - test-4.2-replica_set - - test-4.2-sharded_cluster - test-latest-server-v1-api - test-x509-authentication - test-atlas-connectivity @@ -3672,7 +3467,6 @@ buildvariants: - test-tls-support-6.0 - test-tls-support-5.0 - test-tls-support-4.4 - - test-tls-support-4.2 - name: rhel80-large-node-latest display_name: rhel8 Node Latest run_on: rhel80-large @@ -3702,9 +3496,6 @@ buildvariants: - test-4.4-server - test-4.4-replica_set - test-4.4-sharded_cluster - - test-4.2-server - - test-4.2-replica_set - - test-4.2-sharded_cluster - test-latest-server-v1-api - test-x509-authentication - test-atlas-connectivity @@ -3726,7 +3517,6 @@ buildvariants: - test-tls-support-6.0 - test-tls-support-5.0 - test-tls-support-4.4 - - test-tls-support-4.2 - name: windows-2022-latest-large-iron display_name: Windows Node20.19.0 run_on: windows-2022-latest-large @@ -3756,9 +3546,6 @@ buildvariants: - test-4.4-server - test-4.4-replica_set - test-4.4-sharded_cluster - - test-4.2-server - - test-4.2-replica_set - - test-4.2-sharded_cluster - test-latest-server-v1-api - test-socks5 - test-socks5-tls @@ -3770,7 +3557,6 @@ buildvariants: - test-tls-support-6.0 - test-tls-support-5.0 - test-tls-support-4.4 - - test-tls-support-4.2 - name: windows-2022-latest-large-Node22 display_name: Windows Node22 run_on: windows-2022-latest-large @@ -3800,9 +3586,6 @@ buildvariants: - test-4.4-server - test-4.4-replica_set - test-4.4-sharded_cluster - - test-4.2-server - - test-4.2-replica_set - - test-4.2-sharded_cluster - test-latest-server-v1-api - test-socks5 - test-socks5-tls @@ -3814,7 +3597,6 @@ buildvariants: - test-tls-support-6.0 - test-tls-support-5.0 - test-tls-support-4.4 - - test-tls-support-4.2 - name: windows-2022-latest-large-Node24 display_name: Windows Node24 run_on: windows-2022-latest-large @@ -3844,9 +3626,6 @@ buildvariants: - test-4.4-server - test-4.4-replica_set - test-4.4-sharded_cluster - - test-4.2-server - - test-4.2-replica_set - - test-4.2-sharded_cluster - test-latest-server-v1-api - test-socks5 - test-socks5-tls @@ -3858,7 +3637,6 @@ buildvariants: - test-tls-support-6.0 - test-tls-support-5.0 - test-tls-support-4.4 - - test-tls-support-4.2 - name: windows-2022-latest-large-node-latest display_name: Windows Node Latest run_on: windows-2022-latest-large @@ -3888,9 +3666,6 @@ buildvariants: - test-4.4-server - test-4.4-replica_set - test-4.4-sharded_cluster - - test-4.2-server - - test-4.2-replica_set - - test-4.2-sharded_cluster - test-latest-server-v1-api - test-socks5-tls - test-snappy-compression @@ -3901,7 +3676,6 @@ buildvariants: - test-tls-support-6.0 - test-tls-support-5.0 - test-tls-support-4.4 - - test-tls-support-4.2 - name: rhel8-node20.19.0-test-csfle-mongocryptd display_name: rhel 8 Node20.19.0 test mongocryptd run_on: rhel80-large @@ -3917,7 +3691,6 @@ buildvariants: - test-6.0-csfle-mongocryptd - test-5.0-csfle-mongocryptd - test-4.4-csfle-mongocryptd - - test-4.2-csfle-mongocryptd - name: rhel8-node24-test-csfle-mongocryptd display_name: rhel 8 Node24 test mongocryptd run_on: rhel80-large @@ -3933,7 +3706,6 @@ buildvariants: - test-6.0-csfle-mongocryptd - test-5.0-csfle-mongocryptd - test-4.4-csfle-mongocryptd - - test-4.2-csfle-mongocryptd - name: macos-14-arm64 display_name: MacOS 14 ARM Node24 run_on: macos-14-arm64 @@ -4040,9 +3812,6 @@ buildvariants: - test-4.4-server-noauth - test-4.4-replica_set-noauth - test-4.4-sharded_cluster-noauth - - test-4.2-server-noauth - - test-4.2-replica_set-noauth - - test-4.2-sharded_cluster-noauth - name: rhel8-test-lambda display_name: AWS Lambda handler tests run_on: rhel80-large From 55b132b3d53b2cce4ff676d2d26ceec1b1509bdc Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Mon, 13 Jul 2026 20:52:42 -0400 Subject: [PATCH 04/38] chore: remove more refs to 4.2 --- src/bulk/common.ts | 2 +- src/cmap/command_monitoring_events.ts | 6 +- .../change-streams/change_stream.test.ts | 103 +++++------------- ...ient_side_operations_timeout.prose.test.ts | 2 +- .../rtt_pinger.test.ts | 4 +- ...onnections_survive_step_down.prose.test.ts | 4 +- test/integration/crud/find.test.ts | 25 ----- .../retryable_reads.spec.prose.test.ts | 2 +- .../retryable_writes.spec.prose.test.ts | 8 +- ...ver_discovery_and_monitoring.prose.test.ts | 4 +- ...er_selection.prose.operation_count.test.ts | 4 +- ...tion.prose.sharded_retryable_reads.test.ts | 2 +- .../sessions/sessions.prose.test.ts | 2 +- .../findOneAndDelete-hint-unacknowledged.yml | 28 ----- 14 files changed, 45 insertions(+), 151 deletions(-) diff --git a/src/bulk/common.ts b/src/bulk/common.ts index 26c0d750d9c..1927109c957 100644 --- a/src/bulk/common.ts +++ b/src/bulk/common.ts @@ -1011,7 +1011,7 @@ export abstract class BulkOperationBase { * // Add a replaceOne * bulkOp.find({ i: 9 }).replaceOne({writeConcern: { j: 10 }}); * - * // Update using a pipeline (requires Mongodb 4.2 or higher) + * // Update using a pipeline (requires Mongodb 4.4 or higher) * bulk.find({ k: 11, y: { $exists: true }, z: { $exists: true } }).updateOne([ * { $set: { total: { $sum: [ '$y', '$z' ] } } } * ]); diff --git a/src/cmap/command_monitoring_events.ts b/src/cmap/command_monitoring_events.ts index b5e7c776d57..2b16e897bb9 100644 --- a/src/cmap/command_monitoring_events.ts +++ b/src/cmap/command_monitoring_events.ts @@ -32,7 +32,7 @@ export class CommandStartedEvent { /** * Server generated connection id * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" - * from the server on 4.2+. + * from the server on 4.4+. */ serverConnectionId: bigint | null; serviceId?: ObjectId; @@ -88,7 +88,7 @@ export class CommandSucceededEvent { connectionId?: string | number; /** * Server generated connection id - * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" from the server on 4.2+. + * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" from the server on 4.4+. */ serverConnectionId: bigint | null; requestId: number; @@ -148,7 +148,7 @@ export class CommandFailedEvent { connectionId?: string | number; /** * Server generated connection id - * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" from the server on 4.2+. + * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" from the server on 4.4+. */ serverConnectionId: bigint | null; requestId: number; diff --git a/test/integration/change-streams/change_stream.test.ts b/test/integration/change-streams/change_stream.test.ts index bdcdfa6b829..f4f705ee5ff 100644 --- a/test/integration/change-streams/change_stream.test.ts +++ b/test/integration/change-streams/change_stream.test.ts @@ -37,9 +37,6 @@ const initIteratorMode = async (cs: ChangeStream) => { return; }; -const is4_2Server = (serverVersion: string) => - gte(serverVersion, '4.2.0') && lt(serverVersion, '4.3.0'); - // Define the pipeline processing changes const pipeline = [ { $addFields: { addedField: 'This is a field added using $addFields' } }, @@ -1130,9 +1127,7 @@ describe('Change Streams', function () { const unresumableErrorCode = 1000; await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -1947,9 +1942,7 @@ describe('Change Streams', function () { afterEach(async function () { await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: 'off' } as FailCommandFailPoint); @@ -1970,9 +1963,7 @@ describe('Change Streams', function () { }); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2002,9 +1993,7 @@ describe('Change Streams', function () { }); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2036,9 +2025,7 @@ describe('Change Streams', function () { }); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2167,9 +2154,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2195,9 +2180,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 5 }, data: { failCommands: ['getMore'], @@ -2234,9 +2217,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2265,9 +2246,7 @@ describe('ChangeStream resumability', function () { const unresumableErrorCode = 1000; await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2353,9 +2332,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2381,9 +2358,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 5 }, data: { failCommands: ['getMore'], @@ -2420,9 +2395,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2451,9 +2424,7 @@ describe('ChangeStream resumability', function () { const unresumableErrorCode = 1000; await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2507,9 +2478,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2542,9 +2511,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 5 }, data: { failCommands: ['getMore'], @@ -2581,9 +2548,7 @@ describe('ChangeStream resumability', function () { await initIteratorMode(changeStream); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2612,9 +2577,7 @@ describe('ChangeStream resumability', function () { const unresumableErrorCode = 1000; await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2700,9 +2663,7 @@ describe('ChangeStream resumability', function () { await collection.insertMany(docs); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2735,9 +2696,7 @@ describe('ChangeStream resumability', function () { const changeStreamIterator = changeStream[Symbol.asyncIterator](); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2769,9 +2728,7 @@ describe('ChangeStream resumability', function () { const unresumableErrorCode = 1000; await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2868,9 +2825,7 @@ describe('ChangeStream resumability', function () { changeStream = collection.watch([]); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2898,9 +2853,7 @@ describe('ChangeStream resumability', function () { changeStream = collection.watch([]); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 5 }, data: { failCommands: ['getMore'], @@ -2938,9 +2891,7 @@ describe('ChangeStream resumability', function () { changeStream = collection.watch([], changeStreamResumeOptions); await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2972,9 +2923,7 @@ describe('ChangeStream resumability', function () { const unresumableErrorCode = 1000; await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], @@ -2999,9 +2948,7 @@ describe('ChangeStream resumability', function () { const unresumableErrorCode = 237; await client.db('admin').command({ - configureFailPoint: is4_2Server(this.configuration.version) - ? 'failCommand' - : 'failGetMoreAfterCursorCheckout', + configureFailPoint: 'failGetMoreAfterCursorCheckout', mode: { times: 1 }, data: { failCommands: ['getMore'], diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts index a256bce727c..803d8305172 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts @@ -122,7 +122,7 @@ describe('CSOT spec prose tests', function () { context('2. maxTimeMS is not set for commands sent to mongocryptd', () => { /** - * This test MUST only be run against enterprise server versions 4.2 and higher. + * This test MUST only be run against enterprise server versions 4.4 and higher. * * 1. Launch a mongocryptd process on 23000. * 1. Create a MongoClient (referred to as `client`) using the URI `mongodb://localhost:23000/?timeoutMS=1000`. diff --git a/test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts b/test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts index 5b659290ef6..54cc8a292e9 100644 --- a/test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts +++ b/test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts @@ -109,8 +109,8 @@ describe('class RTTPinger', () => { const rttPingers = await getRTTPingers(client); // Fake pre-hello server. - // Hello was back-ported to feature versions of the server so we would need to pin - // versions prior to 4.4.2, 4.2.10, 4.0.21, and 3.6.21 to integration test + // Hello was back-ported to feature versions of the server so we would need to pin patch + // versions prior to 4.4.2 to integration test for (const rtt of rttPingers) rtt.connection.helloOk = false; const spies = rttPingers.map(rtt => sinon.spy(rtt.connection, 'command')); diff --git a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts index 3ba24d95870..b5acd752fb0 100644 --- a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts +++ b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts @@ -44,7 +44,7 @@ describe('Connections Survive Primary Step Down - prose', function () { }); context('getMore Iteration', { requires: { topology: ['replicaset'] } }, () => { - // This test requires a replica set with server version 4.2 or higher. + // This test requires a replica set with server version 4.4 or higher. let cursor: FindCursor; afterEach(() => cursor.close()); @@ -91,7 +91,7 @@ describe('Connections Survive Primary Step Down - prose', function () { }); context('Not Primary - Keep Connection Pool', { requires: { topology: ['replicaset'] } }, () => { - // This test requires a replica set with server version 4.2 or higher. + // This test requires a replica set with server version 4.4or higher. // - Set the following fail point: ``{configureFailPoint: "failCommand", mode: {times: 1}, data: {failCommands: ["insert"], errorCode: 10107}}`` const failPoint: FailCommandFailPoint = { diff --git a/test/integration/crud/find.test.ts b/test/integration/crud/find.test.ts index 9e6ed994f13..60890f2bfa1 100644 --- a/test/integration/crud/find.test.ts +++ b/test/integration/crud/find.test.ts @@ -266,31 +266,6 @@ describe('Find', function () { test.equal(0, documents.length); }); - it('should correctly perform find by $where', { - metadata: { requires: { mongodb: '4.2.x' } }, - test: async function () { - const db = client.db(this.configuration.db); - const collection = await db.createCollection('test_where'); - await collection.insertMany( - [{ a: 1 }, { a: 2 }, { a: 3 }], - this.configuration.writeConcernMax() - ); - - const count = await collection.countDocuments(); - test.equal(3, count); - - // @ts-expect-error: $where no longer supports Code - const documentsGT2 = await collection.find({ $where: new Code('this.a > 2') }).toArray(); - test.equal(1, documentsGT2.length); - - const documentsGT1 = await collection - // @ts-expect-error: $where no longer supports Code - .find({ $where: new Code('this.a > i', { i: 1 }) }) - .toArray(); - test.equal(2, documentsGT1.length); - } - }); - it('should correctly perform finds with hint turned on', async function () { const configuration = this.configuration; const p_client = configuration.newClient(configuration.writeConcernMax(), { diff --git a/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts b/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts index ee95fad6cbf..4346f719e75 100644 --- a/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts +++ b/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts @@ -30,7 +30,7 @@ describe('Retryable Reads Spec Prose', () => { describe('PoolClearedError Retryability Test', () => { // This test will be used to ensure drivers properly retry after encountering PoolClearedErrors. // It MUST be implemented by any driver that implements the CMAP specification. - // This test requires MongoDB 4.2.9+ for blockConnection support in the failpoint. + // This test requires MongoDB 4.4.0+ for blockConnection support in the failpoint. let cmapEvents: Array<{ name: string; event: Record }>; let commandStartedEvents: Array>; diff --git a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts index 430f263011e..c4bf0741279 100644 --- a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts +++ b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts @@ -85,7 +85,7 @@ describe('Retryable Writes Spec Prose', () => { describe('2. Test that drivers properly retry after encountering PoolClearedErrors.', () => { // This test MUST be implemented by any driver that implements the CMAP specification. - // This test requires MongoDB 4.2.9+ for blockConnection support in the failpoint. + // This test requires MongoDB 4.4.+ for blockConnection support in the failpoint. let client: MongoClient; let failPointName: string | undefined; @@ -151,7 +151,7 @@ describe('Retryable Writes Spec Prose', () => { }); it('should emit events in the expected sequence', { - metadata: { requires: { mongodb: '>=4.2.9', topology: ['replicaset', 'sharded'] } }, + metadata: { requires: { mongodb: '>=4.4.0', topology: ['replicaset', 'sharded'] } }, test: async function () { // iii. Start two threads and attempt to perform an insertOne simultaneously on both. await Promise.all([ @@ -276,7 +276,7 @@ describe('Retryable Writes Spec Prose', () => { */ it( 'when a retry attempt fails with an error labeled NoWritesPerformed, drivers MUST return the original error', - { requires: { topology: 'replicaset', mongodb: '>=4.2.9' } }, + { requires: { topology: 'replicaset', mongodb: '>=4.4.0' } }, async () => { const serverCommandStub = sinon.stub(Server.prototype, 'command'); serverCommandStub.onCall(0).rejects( @@ -310,7 +310,7 @@ describe('Retryable Writes Spec Prose', () => { // must succeed, we fail if any command failed event occurs on insert. it( 'emits a command succeeded event for write concern errors with ok: 1', - { requires: { topology: 'replicaset', mongodb: '>=4.2.9' } }, + { requires: { topology: 'replicaset', mongodb: '>=4.4.0' } }, async () => { // Generate a write concern error to assert that we get a command // suceeded event but the operation will retry because it was an diff --git a/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts b/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts index 1f4cec00571..508e2741a7e 100644 --- a/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts +++ b/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts @@ -94,7 +94,7 @@ describe('Server Discovery and Monitoring Prose Tests', function () { context('Connection Pool Management', function () { /* This test will be used to ensure monitors properly create and unpause connection pools when they discover servers. - This test requires failCommand appName support which is only available in MongoDB 4.2.9+. + This test requires failCommand appName support which is only available in MongoDB 4.4.0+. 1. Create a client with directConnection=true, appName="SDAMPoolManagementTest", and heartbeatFrequencyMS=500 (or lower if possible). 2. Verify via SDAM and CMAP event monitoring that a ConnectionPoolReadyEvent occurs after the first ServerHeartbeatSucceededEvent event does. 3. Enable the following failpoint: @@ -153,7 +153,7 @@ describe('Server Discovery and Monitoring Prose Tests', function () { }); it('ensure monitors properly create and unpause connection pools when they discover servers', { - metadata: { requires: { mongodb: '>=4.2.9', topology: '!load-balanced' } }, + metadata: { requires: { mongodb: '>=4.4.0', topology: '!load-balanced' } }, test: async function () { await client.connect(); expect(events.shift()).to.equal(SERVER_HEARTBEAT_SUCCEEDED); diff --git a/test/integration/server-selection/server_selection.prose.operation_count.test.ts b/test/integration/server-selection/server_selection.prose.operation_count.test.ts index b4a7d9bf47b..f34f485a38a 100644 --- a/test/integration/server-selection/server_selection.prose.operation_count.test.ts +++ b/test/integration/server-selection/server_selection.prose.operation_count.test.ts @@ -27,8 +27,8 @@ async function runTaskGroup(collection: Collection, count: 10 | 100 | 1000) { } } -// Step 1: Configure a sharded cluster with two mongoses. Use a 4.2.9 or newer server version. -const TEST_METADATA: MongoDBMetadataUI = { requires: { mongodb: '>=4.2.9', topology: 'sharded' } }; +// Step 1: Configure a sharded cluster with two mongoses. Use a 4.4.0 or newer server version. +const TEST_METADATA: MongoDBMetadataUI = { requires: { mongodb: '>=4.4.0', topology: 'sharded' } }; describe('operationCount-based Selection Within Latency Window - Prose Test', function () { let client: MongoClient; diff --git a/test/integration/server-selection/server_selection.prose.sharded_retryable_reads.test.ts b/test/integration/server-selection/server_selection.prose.sharded_retryable_reads.test.ts index 3b72fe93eb1..9312c0dc33d 100644 --- a/test/integration/server-selection/server_selection.prose.sharded_retryable_reads.test.ts +++ b/test/integration/server-selection/server_selection.prose.sharded_retryable_reads.test.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import type { CommandFailedEvent, CommandSucceededEvent } from '../../mongodb'; -const TEST_METADATA = { requires: { mongodb: '>=4.2.9', topology: 'sharded' } }; +const TEST_METADATA = { requires: { mongodb: '>=4.4.0', topology: 'sharded' } }; const FAIL_COMMAND = { configureFailPoint: 'failCommand', mode: { times: 1 }, diff --git a/test/integration/sessions/sessions.prose.test.ts b/test/integration/sessions/sessions.prose.test.ts index b6be8d763ed..b1c67810d68 100644 --- a/test/integration/sessions/sessions.prose.test.ts +++ b/test/integration/sessions/sessions.prose.test.ts @@ -129,7 +129,7 @@ describe('Sessions Prose Tests', () => { /** * Since all regular 3.6+ servers support sessions, the prose tests which test for * session non-support SHOULD use a mongocryptd server as the test server - * (available with server versions 4.2+) + * (available with server versions 4.4+) * * As part of the test setup for these cases, create a MongoClient pointed at the test server * with the options specified in the test case and verify that the test server does NOT define a diff --git a/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.yml b/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.yml index 2b29a4923ea..bb39b9b3c5b 100644 --- a/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.yml +++ b/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.yml @@ -26,34 +26,6 @@ initialData: - { _id: 2, x: 22 } tests: - - description: "Unacknowledged findOneAndDelete with hint string fails with client-side error on pre-4.4 server" - runOnRequirements: - - maxServerVersion: "4.2.99" - operations: - - object: *collection0 - name: findOneAndDelete - arguments: - filter: &filter { _id: { $gt: 1 } } - hint: _id_ - expectError: - isClientError: true - expectEvents: &noEvents - - client: *client0 - events: [] - - - description: "Unacknowledged findOneAndDelete with hint document fails with client-side error on pre-4.4 server" - runOnRequirements: - - maxServerVersion: "4.2.99" - operations: - - object: *collection0 - name: findOneAndDelete - arguments: - filter: *filter - hint: { _id: 1 } - expectError: - isClientError: true - expectEvents: *noEvents - - description: "Unacknowledged findOneAndDelete with hint string on 4.4+ server" runOnRequirements: - minServerVersion: "4.4.0" From 63f8457347860a781f0a909b6ed35e35a4df02da Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 14 Jul 2026 10:56:05 -0400 Subject: [PATCH 05/38] chore: remove all tests relying on <4.2 infra --- .../change-streams-resume-allowlist.json | 2032 ----------------- .../unified/change-streams.json | 129 -- .../change-streams/unified/change-streams.yml | 61 - test/spec/crud/unified/aggregate.json | 177 -- test/spec/crud/unified/aggregate.yml | 68 - test/spec/crud/unified/bulkWrite-comment.json | 107 - test/spec/crud/unified/bulkWrite-comment.yml | 26 +- ...kWrite-deleteMany-hint-unacknowledged.json | 76 - ...lkWrite-deleteOne-hint-unacknowledged.json | 76 - .../spec/crud/unified/deleteMany-comment.json | 70 - test/spec/crud/unified/deleteMany-comment.yml | 24 - .../deleteMany-hint-unacknowledged.json | 64 - test/spec/crud/unified/deleteOne-comment.json | 66 - test/spec/crud/unified/deleteOne-comment.yml | 24 - .../deleteOne-hint-unacknowledged.json | 64 - test/spec/crud/unified/distinct-comment.json | 46 - test/spec/crud/unified/distinct-comment.yml | 25 - .../estimatedDocumentCount-comment.json | 46 - .../estimatedDocumentCount-comment.yml | 30 - .../find-allowdiskuse-serverError.json | 100 - .../unified/find-allowdiskuse-serverError.yml | 65 - test/spec/crud/unified/find-comment.json | 147 -- test/spec/crud/unified/find-comment.yml | 60 - .../unified/findOneAndDelete-comment.json | 57 - .../crud/unified/findOneAndDelete-comment.yml | 23 - .../findOneAndDelete-hint-unacknowledged.json | 64 - .../unified/findOneAndReplace-comment.json | 62 - .../unified/findOneAndReplace-comment.yml | 25 - ...findOneAndReplace-hint-unacknowledged.json | 70 - .../unified/findOneAndUpdate-comment.json | 70 - .../crud/unified/findOneAndUpdate-comment.yml | 24 - .../findOneAndUpdate-hint-unacknowledged.json | 74 - .../spec/crud/unified/insertMany-comment.json | 60 - test/spec/crud/unified/insertMany-comment.yml | 24 - test/spec/crud/unified/insertOne-comment.json | 58 - test/spec/crud/unified/insertOne-comment.yml | 23 - .../spec/crud/unified/replaceOne-comment.json | 70 - test/spec/crud/unified/replaceOne-comment.yml | 28 - .../spec/crud/unified/updateMany-comment.json | 72 - test/spec/crud/unified/updateMany-comment.yml | 28 - test/spec/crud/unified/updateOne-comment.json | 74 - test/spec/crud/unified/updateOne-comment.yml | 28 - .../unified/insertOne-serverErrors.json | 303 --- .../unified/serverMonitoringMode.json | 176 -- 44 files changed, 1 insertion(+), 4995 deletions(-) delete mode 100644 test/spec/crud/unified/find-allowdiskuse-serverError.json delete mode 100644 test/spec/crud/unified/find-allowdiskuse-serverError.yml diff --git a/test/spec/change-streams/unified/change-streams-resume-allowlist.json b/test/spec/change-streams/unified/change-streams-resume-allowlist.json index b4953ec736a..a64b3d132c2 100644 --- a/test/spec/change-streams/unified/change-streams-resume-allowlist.json +++ b/test/spec/change-streams/unified/change-streams-resume-allowlist.json @@ -186,2038 +186,6 @@ } ] }, - { - "description": "change stream resumes after HostUnreachable", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 6, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after HostNotFound", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 7, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NetworkTimeout", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 89, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after ShutdownInProgress", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 91, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after PrimarySteppedDown", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 189, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after ExceededTimeLimit", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 262, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after SocketException", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 9001, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotWritablePrimary", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 10107, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after InterruptedAtShutdown", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 11600, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after InterruptedDueToReplStateChange", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 11602, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotPrimaryNoSecondaryOk", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 13435, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after NotPrimaryOrSecondary", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 13436, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after StaleShardVersion", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 63, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after StaleEpoch", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 150, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after RetryChangeStream", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 234, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, - { - "description": "change stream resumes after FailedToSatisfyReadPreference", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "globalClient", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "getMore" - ], - "errorCode": 133, - "closeConnection": false - } - } - } - }, - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [] - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "globalCollection0", - "arguments": { - "document": { - "x": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0", - "expectResult": { - "_id": { - "$$exists": true - }, - "documentKey": { - "$$exists": true - }, - "operationType": "insert", - "ns": { - "db": "database0", - "coll": "collection0" - }, - "fullDocument": { - "x": 1, - "_id": { - "$$exists": true - } - } - } - } - ], - "expectEvents": [ - { - "client": "client0", - "ignoreExtraEvents": true, - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": {} - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$exists": true - }, - "collection": "collection0" - }, - "commandName": "getMore", - "databaseName": "database0" - } - }, - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "cursor": {}, - "pipeline": [ - { - "$changeStream": { - "resumeAfter": { - "$$unsetOrMatches": { - "$$exists": true - } - } - } - } - ] - }, - "commandName": "aggregate", - "databaseName": "database0" - } - } - ] - } - ] - }, { "description": "change stream resumes after CursorNotFound", "runOnRequirements": [ diff --git a/test/spec/change-streams/unified/change-streams.json b/test/spec/change-streams/unified/change-streams.json index a155d85b6e4..14349c3fb2d 100644 --- a/test/spec/change-streams/unified/change-streams.json +++ b/test/spec/change-streams/unified/change-streams.json @@ -235,51 +235,6 @@ } ] }, - { - "description": "Test with document comment - pre 4.4", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "comment": { - "name": "test1" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$changeStream": {} - } - ], - "comment": { - "name": "test1" - } - } - } - } - ] - } - ] - }, { "description": "Test with string comment", "operations": [ @@ -402,90 +357,6 @@ } ] }, - { - "description": "Test that comment is not set on getMore - pre 4.4", - "runOnRequirements": [ - { - "maxServerVersion": "4.3.99" - } - ], - "operations": [ - { - "name": "createChangeStream", - "object": "collection0", - "arguments": { - "pipeline": [], - "comment": "comment" - }, - "saveResultAsEntity": "changeStream0" - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 1, - "a": 1 - } - } - }, - { - "name": "iterateUntilDocumentOrError", - "object": "changeStream0" - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "collection0", - "pipeline": [ - { - "$changeStream": {} - } - ], - "comment": "comment" - } - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "collection0", - "documents": [ - { - "_id": 1, - "a": 1 - } - ] - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "collection0", - "comment": { - "$$exists": false - } - }, - "commandName": "getMore", - "databaseName": "database0" - } - } - ] - } - ] - }, { "description": "to field is set in a rename change event", "runOnRequirements": [ diff --git a/test/spec/change-streams/unified/change-streams.yml b/test/spec/change-streams/unified/change-streams.yml index 7f824623a67..600b2ee2c13 100644 --- a/test/spec/change-streams/unified/change-streams.yml +++ b/test/spec/change-streams/unified/change-streams.yml @@ -140,27 +140,6 @@ tests: - $changeStream: {} comment: *comment0 - - description: "Test with document comment - pre 4.4" - runOnRequirements: - - maxServerVersion: "4.2.99" - operations: - - name: createChangeStream - object: *collection0 - arguments: - pipeline: [] - comment: &comment0 { name: "test1" } - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - aggregate: *collection0 - pipeline: - - $changeStream: {} - comment: *comment0 - - description: "Test with string comment" operations: - name: createChangeStream @@ -220,46 +199,6 @@ tests: commandName: getMore databaseName: *database0 - - description: "Test that comment is not set on getMore - pre 4.4" - runOnRequirements: - - maxServerVersion: "4.3.99" - operations: - - name: createChangeStream - object: *collection0 - arguments: - pipeline: [] - comment: "comment" - saveResultAsEntity: &changeStream0 changeStream0 - - name: insertOne - object: *collection0 - arguments: - document: &new_document - _id: 1 - a: 1 - - name: iterateUntilDocumentOrError - object: *changeStream0 - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - aggregate: *collection0 - pipeline: - - $changeStream: {} - comment: "comment" - - commandStartedEvent: - command: - insert: *collection0 - documents: - - *new_document - - commandStartedEvent: - command: - getMore: { $$type: [ int, long ] } - collection: *collection0 - comment: { $$exists: false } - commandName: getMore - databaseName: *database0 - - description: "to field is set in a rename change event" runOnRequirements: - minServerVersion: "4.0.1" diff --git a/test/spec/crud/unified/aggregate.json b/test/spec/crud/unified/aggregate.json index 55634f05f60..7a783ca96ab 100644 --- a/test/spec/crud/unified/aggregate.json +++ b/test/spec/crud/unified/aggregate.json @@ -266,66 +266,6 @@ } ] }, - { - "description": "aggregate with a document comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "aggregate", - "object": "collection0", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "comment": { - "content": "test" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "comment": { - "content": "test" - } - }, - "commandName": "aggregate", - "databaseName": "aggregate-tests" - } - } - ] - } - ] - }, { "description": "aggregate with comment sets comment on getMore", "runOnRequirements": [ @@ -446,123 +386,6 @@ } ] }, - { - "description": "aggregate with comment does not set comment on getMore - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.3.99" - } - ], - "operations": [ - { - "name": "aggregate", - "arguments": { - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "batchSize": 2, - "comment": "comment" - }, - "object": "collection0", - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "aggregate": "coll0", - "pipeline": [ - { - "$match": { - "_id": { - "$gt": 1 - } - } - } - ], - "cursor": { - "batchSize": 2 - }, - "comment": "comment" - }, - "commandName": "aggregate", - "databaseName": "aggregate-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "$$exists": false - } - }, - "commandName": "getMore", - "databaseName": "aggregate-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "$$exists": false - } - }, - "commandName": "getMore", - "databaseName": "aggregate-tests" - } - } - ] - } - ] - }, { "description": "Aggregate with multiple stages", "operations": [ diff --git a/test/spec/crud/unified/aggregate.yml b/test/spec/crud/unified/aggregate.yml index 6f99aaf0fe5..58cf46a1cf1 100644 --- a/test/spec/crud/unified/aggregate.yml +++ b/test/spec/crud/unified/aggregate.yml @@ -102,29 +102,6 @@ tests: pipeline: [ { $match: { _id: { $gt: 1 } } } ] comment: *comment0 - - description: "aggregate with a document comment - pre 4.4" - runOnRequirements: - - minServerVersion: "3.6.0" - maxServerVersion: "4.2.99" - operations: - - name: aggregate - object: *collection0 - arguments: - pipeline: [ { $match: { _id: { $gt: 1 } }} ] - comment: *comment0 - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - aggregate: *collection0Name - pipeline: [ { $match: { _id: { $gt: 1 } }} ] - comment: *comment0 - commandName: aggregate - databaseName: *database0Name - - description: "aggregate with comment sets comment on getMore" runOnRequirements: - minServerVersion: "4.4.0" @@ -168,51 +145,6 @@ tests: comment: *comment0 commandName: getMore databaseName: *database0Name - - - description: "aggregate with comment does not set comment on getMore - pre 4.4" - runOnRequirements: - - minServerVersion: "3.6.0" - maxServerVersion: "4.3.99" - operations: - - name: aggregate - arguments: - pipeline: [ { $match: { _id: { $gt: 1 } }} ] - batchSize: 2 - comment: "comment" - object: *collection0 - expectResult: - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - { _id: 4, x: 44 } - - { _id: 5, x: 55 } - - { _id: 6, x: 66 } - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - aggregate: *collection0Name - pipeline: [ { $match: { _id: { $gt: 1 } }} ] - cursor: { batchSize: 2 } - comment: "comment" - commandName: aggregate - databaseName: *database0Name - - commandStartedEvent: - command: - getMore: { $$type: [ int, long ] } - collection: *collection0Name - batchSize: 2 - comment: { $$exists: false } - commandName: getMore - databaseName: *database0Name - - commandStartedEvent: - command: - getMore: { $$type: [ int, long ] } - collection: *collection0Name - batchSize: 2 - comment: { $$exists: false } - commandName: getMore - databaseName: *database0Name - description: 'Aggregate with multiple stages' operations: diff --git a/test/spec/crud/unified/bulkWrite-comment.json b/test/spec/crud/unified/bulkWrite-comment.json index 0b2addc8505..f918e785d17 100644 --- a/test/spec/crud/unified/bulkWrite-comment.json +++ b/test/spec/crud/unified/bulkWrite-comment.json @@ -407,113 +407,6 @@ ] } ] - }, - { - "description": "BulkWrite with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "insertOne": { - "document": { - "_id": 5, - "x": "inserted" - } - } - }, - { - "replaceOne": { - "filter": { - "_id": 1 - }, - "replacement": { - "_id": 1, - "x": "replaced" - } - } - }, - { - "updateOne": { - "filter": { - "_id": 2 - }, - "update": { - "$set": { - "x": "updated" - } - } - } - }, - { - "deleteOne": { - "filter": { - "_id": 3 - } - } - } - ], - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "BulkWrite_comment", - "documents": [ - { - "_id": 5, - "x": "inserted" - } - ], - "ordered": true, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "BulkWrite_comment", - "databaseName": "crud-v2", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-comment.yml b/test/spec/crud/unified/bulkWrite-comment.yml index 965a0b8384b..85db12c0f9d 100644 --- a/test/spec/crud/unified/bulkWrite-comment.yml +++ b/test/spec/crud/unified/bulkWrite-comment.yml @@ -148,28 +148,4 @@ tests: limit: 1 ordered: true comment: *document_comment - outcome: *outcome - - - description: 'BulkWrite with comment - pre 4.4' - runOnRequirements: - - minServerVersion: "3.4.0" - maxServerVersion: "4.2.99" - operations: - - object: *collection0 - name: bulkWrite - arguments: - requests: *requests - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - insert: *collection_name - documents: - - *inserted_document - ordered: true - comment: "comment" - outcome: *initial_data + outcome: *outcome \ No newline at end of file diff --git a/test/spec/crud/unified/bulkWrite-deleteMany-hint-unacknowledged.json b/test/spec/crud/unified/bulkWrite-deleteMany-hint-unacknowledged.json index 2dda9486e88..a0aa297da18 100644 --- a/test/spec/crud/unified/bulkWrite-deleteMany-hint-unacknowledged.json +++ b/test/spec/crud/unified/bulkWrite-deleteMany-hint-unacknowledged.json @@ -51,82 +51,6 @@ } ], "tests": [ - { - "description": "Unacknowledged deleteMany with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteMany with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteMany": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, { "description": "Unacknowledged deleteMany with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/bulkWrite-deleteOne-hint-unacknowledged.json b/test/spec/crud/unified/bulkWrite-deleteOne-hint-unacknowledged.json index aadf6d9e991..2e57fc74eb7 100644 --- a/test/spec/crud/unified/bulkWrite-deleteOne-hint-unacknowledged.json +++ b/test/spec/crud/unified/bulkWrite-deleteOne-hint-unacknowledged.json @@ -47,82 +47,6 @@ } ], "tests": [ - { - "description": "Unacknowledged deleteOne with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteOne with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "bulkWrite", - "arguments": { - "requests": [ - { - "deleteOne": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - } - } - ] - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, { "description": "Unacknowledged deleteOne with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/deleteMany-comment.json b/test/spec/crud/unified/deleteMany-comment.json index 6abc5fd58a3..1fadc035538 100644 --- a/test/spec/crud/unified/deleteMany-comment.json +++ b/test/spec/crud/unified/deleteMany-comment.json @@ -170,76 +170,6 @@ ] } ] - }, - { - "description": "deleteMany with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "deleteMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": { - "$gt": 1 - } - }, - "limit": 0 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name2" - }, - { - "_id": 3, - "name": "name3" - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/deleteMany-comment.yml b/test/spec/crud/unified/deleteMany-comment.yml index 8f1b3522a76..f2fae731b14 100644 --- a/test/spec/crud/unified/deleteMany-comment.yml +++ b/test/spec/crud/unified/deleteMany-comment.yml @@ -71,27 +71,3 @@ tests: limit: 0 comment: *comment outcome: *outcome - - - description: "deleteMany with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "3.4.0" - maxServerVersion: "4.2.99" - operations: - - name: deleteMany - object: *collection0 - arguments: - filter: *filter - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - delete: *collection0Name - deletes: - - q: *filter - limit: 0 - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/deleteMany-hint-unacknowledged.json b/test/spec/crud/unified/deleteMany-hint-unacknowledged.json index ab7e9c7c094..d62b0db0357 100644 --- a/test/spec/crud/unified/deleteMany-hint-unacknowledged.json +++ b/test/spec/crud/unified/deleteMany-hint-unacknowledged.json @@ -51,70 +51,6 @@ } ], "tests": [ - { - "description": "Unacknowledged deleteMany with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteMany with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteMany", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, { "description": "Unacknowledged deleteMany with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/deleteOne-comment.json b/test/spec/crud/unified/deleteOne-comment.json index 0f42b086a30..36113b8db44 100644 --- a/test/spec/crud/unified/deleteOne-comment.json +++ b/test/spec/crud/unified/deleteOne-comment.json @@ -172,72 +172,6 @@ ] } ] - }, - { - "description": "deleteOne with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "deleteOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "delete": "coll0", - "deletes": [ - { - "q": { - "_id": 1 - }, - "limit": 1 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2, - "name": "name" - }, - { - "_id": 3, - "name": "name" - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/deleteOne-comment.yml b/test/spec/crud/unified/deleteOne-comment.yml index 1e52298f397..f23da349dce 100644 --- a/test/spec/crud/unified/deleteOne-comment.yml +++ b/test/spec/crud/unified/deleteOne-comment.yml @@ -72,27 +72,3 @@ tests: limit: 1 comment: *comment outcome: *outcome - - - description: "deleteOne with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "3.4.0" - maxServerVersion: "4.2.99" - operations: - - name: deleteOne - object: *collection0 - arguments: - filter: *filter - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - delete: *collection0Name - deletes: - - q: *filter - limit: 1 - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/deleteOne-hint-unacknowledged.json b/test/spec/crud/unified/deleteOne-hint-unacknowledged.json index 1782f0f5251..8425194522d 100644 --- a/test/spec/crud/unified/deleteOne-hint-unacknowledged.json +++ b/test/spec/crud/unified/deleteOne-hint-unacknowledged.json @@ -47,70 +47,6 @@ } ], "tests": [ - { - "description": "Unacknowledged deleteOne with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged deleteOne with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "deleteOne", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, { "description": "Unacknowledged deleteOne with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/distinct-comment.json b/test/spec/crud/unified/distinct-comment.json index 11bce9ac9d7..bb1274f122a 100644 --- a/test/spec/crud/unified/distinct-comment.json +++ b/test/spec/crud/unified/distinct-comment.json @@ -135,52 +135,6 @@ ] } ] - }, - { - "description": "distinct with document comment - pre 4.4, server error", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.13" - } - ], - "operations": [ - { - "name": "distinct", - "object": "collection0", - "arguments": { - "fieldName": "x", - "filter": {}, - "comment": { - "key": "value" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "distinct": "coll0", - "key": "x", - "query": {}, - "comment": { - "key": "value" - } - }, - "commandName": "distinct", - "databaseName": "distinct-comment-tests" - } - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/distinct-comment.yml b/test/spec/crud/unified/distinct-comment.yml index c0820099431..4676b146dfc 100644 --- a/test/spec/crud/unified/distinct-comment.yml +++ b/test/spec/crud/unified/distinct-comment.yml @@ -71,28 +71,3 @@ tests: comment: *stringComment commandName: distinct databaseName: *database0Name - - - description: "distinct with document comment - pre 4.4, server error" - runOnRequirements: - - minServerVersion: "3.6.0" - maxServerVersion: "4.4.13" - operations: - - name: distinct - object: *collection0 - arguments: - fieldName: *fieldName - filter: *filter - comment: *documentComment - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - distinct: *collection0Name - key: *fieldName - query: *filter - comment: *documentComment - commandName: distinct - databaseName: *database0Name diff --git a/test/spec/crud/unified/estimatedDocumentCount-comment.json b/test/spec/crud/unified/estimatedDocumentCount-comment.json index 6c0adacc8f1..5a354a1570a 100644 --- a/test/spec/crud/unified/estimatedDocumentCount-comment.json +++ b/test/spec/crud/unified/estimatedDocumentCount-comment.json @@ -119,52 +119,6 @@ ] } ] - }, - { - "description": "estimatedDocumentCount with document comment - pre 4.4.14, server error", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.4.13", - "topologies": [ - "single", - "replicaset" - ] - } - ], - "operations": [ - { - "name": "estimatedDocumentCount", - "object": "collection0", - "arguments": { - "comment": { - "key": "value" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "count": "coll0", - "comment": { - "key": "value" - } - }, - "commandName": "count", - "databaseName": "edc-comment-tests" - } - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/estimatedDocumentCount-comment.yml b/test/spec/crud/unified/estimatedDocumentCount-comment.yml index b7853151048..4f614d2ebe0 100644 --- a/test/spec/crud/unified/estimatedDocumentCount-comment.yml +++ b/test/spec/crud/unified/estimatedDocumentCount-comment.yml @@ -63,33 +63,3 @@ tests: comment: *stringComment commandName: count databaseName: *database0Name - - - description: "estimatedDocumentCount with document comment - pre 4.4.14, server error" - runOnRequirements: - - minServerVersion: "3.6.0" - maxServerVersion: "4.4.13" - # Server does not raise an error if topology is sharded. - # https://jira.mongodb.org/browse/SERVER-65954 - topologies: [ single, replicaset ] - operations: - - name: estimatedDocumentCount - object: *collection0 - arguments: - # Even though according to the docs count command does not support any - # comment for server version less than 4.4, no error is raised by such - # servers. Therefore, we have only one test with a document comment - # to test server errors. - # https://jira.mongodb.org/browse/SERVER-63315 - # Server supports count with comment of any type for comment starting from 4.4.14. - comment: *documentComment - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - count: *collection0Name - comment: *documentComment - commandName: count - databaseName: *database0Name diff --git a/test/spec/crud/unified/find-allowdiskuse-serverError.json b/test/spec/crud/unified/find-allowdiskuse-serverError.json deleted file mode 100644 index dc58f8f0e3a..00000000000 --- a/test/spec/crud/unified/find-allowdiskuse-serverError.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "description": "find-allowdiskuse-serverError", - "schemaVersion": "1.0", - "runOnRequirements": [ - { - "minServerVersion": "3.2", - "maxServerVersion": "4.3.0" - } - ], - "createEntities": [ - { - "client": { - "id": "client0", - "observeEvents": [ - "commandStartedEvent" - ] - } - }, - { - "database": { - "id": "database0", - "client": "client0", - "databaseName": "crud-v2" - } - }, - { - "collection": { - "id": "collection0", - "database": "database0", - "collectionName": "test_find_allowdiskuse_servererror" - } - } - ], - "tests": [ - { - "description": "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": true - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test_find_allowdiskuse_servererror", - "filter": {}, - "allowDiskUse": true - } - } - } - ] - } - ] - }, - { - "description": "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)", - "operations": [ - { - "object": "collection0", - "name": "find", - "arguments": { - "filter": {}, - "allowDiskUse": false - }, - "expectError": { - "isError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "test_find_allowdiskuse_servererror", - "filter": {}, - "allowDiskUse": false - } - } - } - ] - } - ] - } - ] -} diff --git a/test/spec/crud/unified/find-allowdiskuse-serverError.yml b/test/spec/crud/unified/find-allowdiskuse-serverError.yml deleted file mode 100644 index 86f48d18e58..00000000000 --- a/test/spec/crud/unified/find-allowdiskuse-serverError.yml +++ /dev/null @@ -1,65 +0,0 @@ -description: find-allowdiskuse-serverError -schemaVersion: '1.0' -runOnRequirements: - - - minServerVersion: '3.2' - maxServerVersion: 4.3.0 -createEntities: - - - client: - id: &client0 client0 - observeEvents: - - commandStartedEvent - - - database: - id: &database0 database0 - client: client0 - databaseName: &database_name crud-v2 - - - collection: - id: &collection0 collection0 - database: database0 - collectionName: &collection_name test_find_allowdiskuse_servererror -tests: - - - description: 'Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)' - operations: - - - object: *collection0 - name: find - arguments: - filter: &filter { } - allowDiskUse: true - expectError: - isError: true - expectEvents: - - - client: *client0 - events: - - - commandStartedEvent: - command: - find: *collection_name - filter: *filter - allowDiskUse: true - - - description: 'Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)' - operations: - - - object: *collection0 - name: find - arguments: - filter: *filter - allowDiskUse: false - expectError: - isError: true - expectEvents: - - - client: *client0 - events: - - - commandStartedEvent: - command: - find: *collection_name - filter: *filter - allowDiskUse: false diff --git a/test/spec/crud/unified/find-comment.json b/test/spec/crud/unified/find-comment.json index 600a3723f15..d7771b8d733 100644 --- a/test/spec/crud/unified/find-comment.json +++ b/test/spec/crud/unified/find-comment.json @@ -148,52 +148,6 @@ } ] }, - { - "description": "find with document comment - pre 4.4", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99", - "minServerVersion": "3.6" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": { - "key": "value" - } - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": 1 - }, - "comment": { - "key": "value" - } - } - } - } - ] - } - ] - }, { "description": "find with comment sets comment on getMore", "runOnRequirements": [ @@ -297,107 +251,6 @@ ] } ] - }, - { - "description": "find with comment does not set comment on getMore - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.6.0", - "maxServerVersion": "4.3.99" - } - ], - "operations": [ - { - "name": "find", - "object": "collection0", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2, - "comment": "comment" - }, - "expectResult": [ - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - }, - { - "_id": 4, - "x": 44 - }, - { - "_id": 5, - "x": 55 - }, - { - "_id": 6, - "x": 66 - } - ] - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "find": "coll0", - "filter": { - "_id": { - "$gt": 1 - } - }, - "batchSize": 2, - "comment": "comment" - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "$$exists": false - } - } - } - }, - { - "commandStartedEvent": { - "command": { - "getMore": { - "$$type": [ - "int", - "long" - ] - }, - "collection": "coll0", - "batchSize": 2, - "comment": { - "$$exists": false - } - } - } - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/find-comment.yml b/test/spec/crud/unified/find-comment.yml index 905241ad0e9..99dfed19bbf 100644 --- a/test/spec/crud/unified/find-comment.yml +++ b/test/spec/crud/unified/find-comment.yml @@ -67,27 +67,6 @@ tests: filter: *filter comment: *comment - - description: "find with document comment - pre 4.4" - runOnRequirements: - - maxServerVersion: "4.2.99" - minServerVersion: "3.6" - operations: - - name: find - object: *collection0 - arguments: - filter: *filter - comment: *comment - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - find: *collection0Name - filter: *filter - comment: *comment - - description: "find with comment sets comment on getMore" runOnRequirements: - minServerVersion: "4.4.0" @@ -125,42 +104,3 @@ tests: collection: *collection0Name batchSize: 2 comment: *comment - - - description: "find with comment does not set comment on getMore - pre 4.4" - runOnRequirements: - - minServerVersion: "3.6.0" - maxServerVersion: "4.3.99" - operations: - - name: find - object: *collection0 - arguments: - filter: &filter_get_more { _id: { $gt: 1 } } - batchSize: 2 - comment: "comment" - expectResult: - - { _id: 2, x: 22 } - - { _id: 3, x: 33 } - - { _id: 4, x: 44 } - - { _id: 5, x: 55 } - - { _id: 6, x: 66 } - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - find: *collection0Name - filter: { _id: { $gt: 1 } } - batchSize: 2 - comment: "comment" - - commandStartedEvent: - command: - getMore: { $$type: [ int, long ] } - collection: *collection0Name - batchSize: 2 - comment: { $$exists: false } - - commandStartedEvent: - command: - getMore: { $$type: [ int, long ] } - collection: *collection0Name - batchSize: 2 - comment: { $$exists: false } diff --git a/test/spec/crud/unified/findOneAndDelete-comment.json b/test/spec/crud/unified/findOneAndDelete-comment.json index 6853b9cc2d7..ed51f55b5f5 100644 --- a/test/spec/crud/unified/findOneAndDelete-comment.json +++ b/test/spec/crud/unified/findOneAndDelete-comment.json @@ -149,63 +149,6 @@ ] } ] - }, - { - "description": "findOneAndDelete with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "findOneAndDelete", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "remove": true, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/findOneAndDelete-comment.yml b/test/spec/crud/unified/findOneAndDelete-comment.yml index dfa7ff2ce0a..322719a0c83 100644 --- a/test/spec/crud/unified/findOneAndDelete-comment.yml +++ b/test/spec/crud/unified/findOneAndDelete-comment.yml @@ -71,26 +71,3 @@ tests: remove: true comment: *comment outcome: *outcome - - - description: "findOneAndDelete with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "4.2.0" # findAndModify option validation was introduced in 4.2 - maxServerVersion: "4.2.99" - operations: - - name: findOneAndDelete - object: *collection0 - arguments: - filter: *filter - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - findAndModify: *collection0Name - query: *filter - remove: true - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.json b/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.json index 077f9892b93..d6e51186db2 100644 --- a/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.json +++ b/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.json @@ -47,70 +47,6 @@ } ], "tests": [ - { - "description": "Unacknowledged findOneAndDelete with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndDelete with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndDelete", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, { "description": "Unacknowledged findOneAndDelete with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/findOneAndReplace-comment.json b/test/spec/crud/unified/findOneAndReplace-comment.json index f817bb69375..868405ce7e9 100644 --- a/test/spec/crud/unified/findOneAndReplace-comment.json +++ b/test/spec/crud/unified/findOneAndReplace-comment.json @@ -167,68 +167,6 @@ ] } ] - }, - { - "description": "findOneAndReplace with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "findOneAndReplace", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 5 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": { - "x": 5 - }, - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/findOneAndReplace-comment.yml b/test/spec/crud/unified/findOneAndReplace-comment.yml index 2c6aaef07ba..ed939b986ed 100644 --- a/test/spec/crud/unified/findOneAndReplace-comment.yml +++ b/test/spec/crud/unified/findOneAndReplace-comment.yml @@ -74,28 +74,3 @@ tests: update: *replacement comment: *comment outcome: *outcome - - - - description: "findOneAndReplace with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "4.2.0" # findAndModify option validation was introduced in 4.2 - maxServerVersion: "4.2.99" - operations: - - name: findOneAndReplace - object: *collection0 - arguments: - filter: *filter - replacement: *replacement - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - findAndModify: *collection0Name - query: *filter - update: *replacement - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/findOneAndReplace-hint-unacknowledged.json b/test/spec/crud/unified/findOneAndReplace-hint-unacknowledged.json index 8228d8a2aa9..f2aa892b4d2 100644 --- a/test/spec/crud/unified/findOneAndReplace-hint-unacknowledged.json +++ b/test/spec/crud/unified/findOneAndReplace-hint-unacknowledged.json @@ -54,76 +54,6 @@ } ], "tests": [ - { - "description": "Unacknowledged findOneAndReplace with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndReplace with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndReplace", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "replacement": { - "x": 111 - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, { "description": "Unacknowledged findOneAndReplace with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/findOneAndUpdate-comment.json b/test/spec/crud/unified/findOneAndUpdate-comment.json index 6dec5b39eee..2759e65321c 100644 --- a/test/spec/crud/unified/findOneAndUpdate-comment.json +++ b/test/spec/crud/unified/findOneAndUpdate-comment.json @@ -153,76 +153,6 @@ ] } ] - }, - { - "description": "findOneAndUpdate with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "4.2.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "findOneAndUpdate", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 - } - } - ], - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "findAndModify": "coll0", - "query": { - "_id": 1 - }, - "update": [ - { - "$set": { - "x": 5 - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1 - }, - { - "_id": 2 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/findOneAndUpdate-comment.yml b/test/spec/crud/unified/findOneAndUpdate-comment.yml index 66d2d099c1d..37c5f518ec1 100644 --- a/test/spec/crud/unified/findOneAndUpdate-comment.yml +++ b/test/spec/crud/unified/findOneAndUpdate-comment.yml @@ -69,27 +69,3 @@ tests: query: *filter update: *update comment: *comment - - - description: "findOneAndUpdate with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "4.2.0" # findAndModify option validation was introduced in 4.2 - maxServerVersion: "4.2.99" - operations: - - name: findOneAndUpdate - object: *collection0 - arguments: - filter: *filter - update: *update - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - findAndModify: *collection0Name - query: *filter - update: *update - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/findOneAndUpdate-hint-unacknowledged.json b/test/spec/crud/unified/findOneAndUpdate-hint-unacknowledged.json index d116a06d0d0..7759577b7c4 100644 --- a/test/spec/crud/unified/findOneAndUpdate-hint-unacknowledged.json +++ b/test/spec/crud/unified/findOneAndUpdate-hint-unacknowledged.json @@ -47,80 +47,6 @@ } ], "tests": [ - { - "description": "Unacknowledged findOneAndUpdate with hint string fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": "_id_" - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, - { - "description": "Unacknowledged findOneAndUpdate with hint document fails with client-side error on pre-4.4 server", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "object": "collection0", - "name": "findOneAndUpdate", - "arguments": { - "filter": { - "_id": { - "$gt": 1 - } - }, - "update": { - "$inc": { - "x": 1 - } - }, - "hint": { - "_id": 1 - } - }, - "expectError": { - "isClientError": true - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [] - } - ] - }, { "description": "Unacknowledged findOneAndUpdate with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/insertMany-comment.json b/test/spec/crud/unified/insertMany-comment.json index 2b4c80b3f06..46916c9f861 100644 --- a/test/spec/crud/unified/insertMany-comment.json +++ b/test/spec/crud/unified/insertMany-comment.json @@ -161,66 +161,6 @@ ] } ] - }, - { - "description": "insertMany with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "insertMany", - "object": "collection0", - "arguments": { - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/insertMany-comment.yml b/test/spec/crud/unified/insertMany-comment.yml index 4b51584df2b..58176897ef8 100644 --- a/test/spec/crud/unified/insertMany-comment.yml +++ b/test/spec/crud/unified/insertMany-comment.yml @@ -67,27 +67,3 @@ tests: - *document comment: *comment outcome: *outcome - - - description: "insertMany with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "3.4.0" - maxServerVersion: "4.2.99" - operations: - - name: insertMany - object: *collection0 - arguments: - documents: - - *document - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - insert: *collection0Name - documents: - - *document - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/insertOne-comment.json b/test/spec/crud/unified/insertOne-comment.json index dbd83d9f642..0e34aea80ac 100644 --- a/test/spec/crud/unified/insertOne-comment.json +++ b/test/spec/crud/unified/insertOne-comment.json @@ -157,64 +157,6 @@ ] } ] - }, - { - "description": "insertOne with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 2, - "x": 22 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll0", - "documents": [ - { - "_id": 2, - "x": 22 - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/insertOne-comment.yml b/test/spec/crud/unified/insertOne-comment.yml index f8cb60ce85a..309d81b696f 100644 --- a/test/spec/crud/unified/insertOne-comment.yml +++ b/test/spec/crud/unified/insertOne-comment.yml @@ -66,26 +66,3 @@ tests: - *document comment: *comment outcome: *outcome - - - description: "insertOne with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "3.4.0" - maxServerVersion: "4.2.99" - operations: - - name: insertOne - object: *collection0 - arguments: - document: *document - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - insert: *collection0Name - documents: - - *document - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/replaceOne-comment.json b/test/spec/crud/unified/replaceOne-comment.json index 88bee5d7b7a..8215445a252 100644 --- a/test/spec/crud/unified/replaceOne-comment.json +++ b/test/spec/crud/unified/replaceOne-comment.json @@ -173,76 +173,6 @@ ] } ] - }, - { - "description": "ReplaceOne with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "replaceOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "replacement": { - "x": 22 - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "x": 22 - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/replaceOne-comment.yml b/test/spec/crud/unified/replaceOne-comment.yml index 2c22b287572..ef186008ab7 100644 --- a/test/spec/crud/unified/replaceOne-comment.yml +++ b/test/spec/crud/unified/replaceOne-comment.yml @@ -75,31 +75,3 @@ tests: upsert: { $$unsetOrMatches: false } comment: *comment outcome: *outcome - - - description: "ReplaceOne with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "3.4.0" - maxServerVersion: "4.2.99" - operations: - - name: replaceOne - object: *collection0 - arguments: - filter: *filter - replacement: *replacement - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - update: *collection0Name - updates: - - - q: *filter - u: *replacement - multi: { $$unsetOrMatches: false } - upsert: { $$unsetOrMatches: false } - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/updateMany-comment.json b/test/spec/crud/unified/updateMany-comment.json index 88b8b67f5a1..99e1ad15b2d 100644 --- a/test/spec/crud/unified/updateMany-comment.json +++ b/test/spec/crud/unified/updateMany-comment.json @@ -177,78 +177,6 @@ ] } ] - }, - { - "description": "UpdateMany with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "updateMany", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 22 - } - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 22 - } - }, - "multi": true, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/updateMany-comment.yml b/test/spec/crud/unified/updateMany-comment.yml index 4c6fbacd771..0a9283aeab1 100644 --- a/test/spec/crud/unified/updateMany-comment.yml +++ b/test/spec/crud/unified/updateMany-comment.yml @@ -74,31 +74,3 @@ tests: upsert: { $$unsetOrMatches: false } comment: *comment outcome: *outcome - - - description: "UpdateMany with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "3.4.0" - maxServerVersion: "4.2.99" - operations: - - name: updateMany - object: *collection0 - arguments: - filter: *filter - update: *update - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - update: *collection0Name - updates: - - - q: *filter - u: *update - multi: true - upsert: { $$unsetOrMatches: false } - comment: "comment" - outcome: *initialData diff --git a/test/spec/crud/unified/updateOne-comment.json b/test/spec/crud/unified/updateOne-comment.json index f4ee74db38b..02ab02e0480 100644 --- a/test/spec/crud/unified/updateOne-comment.json +++ b/test/spec/crud/unified/updateOne-comment.json @@ -181,80 +181,6 @@ ] } ] - }, - { - "description": "UpdateOne with comment - pre 4.4", - "runOnRequirements": [ - { - "minServerVersion": "3.4.0", - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "updateOne", - "object": "collection0", - "arguments": { - "filter": { - "_id": 1 - }, - "update": { - "$set": { - "x": 22 - } - }, - "comment": "comment" - }, - "expectError": { - "isClientError": false - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "update": "coll0", - "updates": [ - { - "q": { - "_id": 1 - }, - "u": { - "$set": { - "x": 22 - } - }, - "multi": { - "$$unsetOrMatches": false - }, - "upsert": { - "$$unsetOrMatches": false - } - } - ], - "comment": "comment" - } - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll0", - "databaseName": "crud-tests", - "documents": [ - { - "_id": 1, - "x": 11 - } - ] - } - ] } ] } diff --git a/test/spec/crud/unified/updateOne-comment.yml b/test/spec/crud/unified/updateOne-comment.yml index a176d620ebd..d549c3adaa1 100644 --- a/test/spec/crud/unified/updateOne-comment.yml +++ b/test/spec/crud/unified/updateOne-comment.yml @@ -74,31 +74,3 @@ tests: upsert: { $$unsetOrMatches: false } comment: *comment outcome: *outcome - - - description: "UpdateOne with comment - pre 4.4" - runOnRequirements: - - minServerVersion: "3.4.0" - maxServerVersion: "4.2.99" - operations: - - name: updateOne - object: *collection0 - arguments: - filter: *filter - update: *update - comment: "comment" - expectError: - isClientError: false - expectEvents: - - client: *client0 - events: - - commandStartedEvent: - command: - update: *collection0Name - updates: - - - q: *filter - u: *update - multi: { $$unsetOrMatches: false } - upsert: { $$unsetOrMatches: false } - comment: "comment" - outcome: *initialData diff --git a/test/spec/retryable-writes/unified/insertOne-serverErrors.json b/test/spec/retryable-writes/unified/insertOne-serverErrors.json index 8edafb7029b..01f5e387289 100644 --- a/test/spec/retryable-writes/unified/insertOne-serverErrors.json +++ b/test/spec/retryable-writes/unified/insertOne-serverErrors.json @@ -167,309 +167,6 @@ } ] }, - { - "description": "RetryableWriteError label is added based on top-level code in pre-4.4 server response", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99", - "topologies": [ - "replicaset", - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "errorCode": 189 - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - } - ] - } - ] - }, - { - "description": "RetryableWriteError label is added based on writeConcernError in pre-4.4 mongod response", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99", - "topologies": [ - "replicaset" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 2 - }, - "data": { - "failCommands": [ - "insert" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "errorLabelsContain": [ - "RetryableWriteError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - }, - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, - { - "description": "RetryableWriteError label is not added based on writeConcernError in pre-4.4 mongos response", - "runOnRequirements": [ - { - "minServerVersion": "4.2", - "maxServerVersion": "4.2.99", - "topologies": [ - "sharded" - ] - } - ], - "operations": [ - { - "name": "failPoint", - "object": "testRunner", - "arguments": { - "client": "client0", - "failPoint": { - "configureFailPoint": "failCommand", - "mode": { - "times": 1 - }, - "data": { - "failCommands": [ - "insert" - ], - "writeConcernError": { - "code": 91, - "errmsg": "Replication is being shut down" - } - } - } - } - }, - { - "name": "insertOne", - "object": "collection0", - "arguments": { - "document": { - "_id": 3, - "x": 33 - } - }, - "expectError": { - "errorLabelsOmit": [ - "RetryableWriteError" - ] - } - } - ], - "expectEvents": [ - { - "client": "client0", - "events": [ - { - "commandStartedEvent": { - "command": { - "insert": "coll", - "documents": [ - { - "_id": 3, - "x": 33 - } - ] - }, - "commandName": "insert", - "databaseName": "retryable-writes-tests" - } - } - ] - } - ], - "outcome": [ - { - "collectionName": "coll", - "databaseName": "retryable-writes-tests", - "documents": [ - { - "_id": 1, - "x": 11 - }, - { - "_id": 2, - "x": 22 - }, - { - "_id": 3, - "x": 33 - } - ] - } - ] - }, { "description": "InsertOne succeeds after connection failure", "operations": [ diff --git a/test/spec/server-discovery-and-monitoring/unified/serverMonitoringMode.json b/test/spec/server-discovery-and-monitoring/unified/serverMonitoringMode.json index 7d681b4f9ec..970d4a0f9bd 100644 --- a/test/spec/server-discovery-and-monitoring/unified/serverMonitoringMode.json +++ b/test/spec/server-discovery-and-monitoring/unified/serverMonitoringMode.json @@ -99,94 +99,6 @@ } ] }, - { - "description": "connect with serverMonitoringMode=auto <4.4", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "createEntities", - "object": "testRunner", - "arguments": { - "entities": [ - { - "client": { - "id": "client", - "uriOptions": { - "serverMonitoringMode": "auto", - "heartbeatFrequencyMS": 500 - }, - "useMultipleMongoses": false, - "observeEvents": [ - "serverHeartbeatStartedEvent", - "serverHeartbeatSucceededEvent", - "serverHeartbeatFailedEvent" - ] - } - }, - { - "database": { - "id": "db", - "client": "client", - "databaseName": "sdam-tests" - } - } - ] - } - }, - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectResult": { - "ok": 1 - } - }, - { - "name": "waitForEvent", - "object": "testRunner", - "arguments": { - "client": "client", - "event": { - "serverHeartbeatStartedEvent": {} - }, - "count": 2 - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "sdam", - "ignoreExtraEvents": true, - "events": [ - { - "serverHeartbeatStartedEvent": { - "awaited": false - } - }, - { - "serverHeartbeatSucceededEvent": { - "awaited": false - } - }, - { - "serverHeartbeatStartedEvent": { - "awaited": false - } - } - ] - } - ] - }, { "description": "connect with serverMonitoringMode=stream >=4.4", "runOnRequirements": [ @@ -274,94 +186,6 @@ } ] }, - { - "description": "connect with serverMonitoringMode=stream <4.4", - "runOnRequirements": [ - { - "maxServerVersion": "4.2.99" - } - ], - "operations": [ - { - "name": "createEntities", - "object": "testRunner", - "arguments": { - "entities": [ - { - "client": { - "id": "client", - "uriOptions": { - "serverMonitoringMode": "stream", - "heartbeatFrequencyMS": 500 - }, - "useMultipleMongoses": false, - "observeEvents": [ - "serverHeartbeatStartedEvent", - "serverHeartbeatSucceededEvent", - "serverHeartbeatFailedEvent" - ] - } - }, - { - "database": { - "id": "db", - "client": "client", - "databaseName": "sdam-tests" - } - } - ] - } - }, - { - "name": "runCommand", - "object": "db", - "arguments": { - "commandName": "ping", - "command": { - "ping": 1 - } - }, - "expectResult": { - "ok": 1 - } - }, - { - "name": "waitForEvent", - "object": "testRunner", - "arguments": { - "client": "client", - "event": { - "serverHeartbeatStartedEvent": {} - }, - "count": 2 - } - } - ], - "expectEvents": [ - { - "client": "client", - "eventType": "sdam", - "ignoreExtraEvents": true, - "events": [ - { - "serverHeartbeatStartedEvent": { - "awaited": false - } - }, - { - "serverHeartbeatSucceededEvent": { - "awaited": false - } - }, - { - "serverHeartbeatStartedEvent": { - "awaited": false - } - } - ] - } - ] - }, { "description": "connect with serverMonitoringMode=poll", "operations": [ From f7d54ebc3ad9e013ff2f3b863898eb389c208704 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 14 Jul 2026 11:22:24 -0400 Subject: [PATCH 06/38] Revert "chore: remove all tests relying on <4.2 infra" This reverts commit dcafee64a418969be1de00250d62e911730a14f6. --- .../change-streams-resume-allowlist.json | 2032 +++++++++++++++++ .../unified/change-streams.json | 129 ++ .../change-streams/unified/change-streams.yml | 61 + test/spec/crud/unified/aggregate.json | 177 ++ test/spec/crud/unified/aggregate.yml | 68 + test/spec/crud/unified/bulkWrite-comment.json | 107 + test/spec/crud/unified/bulkWrite-comment.yml | 26 +- ...kWrite-deleteMany-hint-unacknowledged.json | 76 + ...lkWrite-deleteOne-hint-unacknowledged.json | 76 + .../spec/crud/unified/deleteMany-comment.json | 70 + test/spec/crud/unified/deleteMany-comment.yml | 24 + .../deleteMany-hint-unacknowledged.json | 64 + test/spec/crud/unified/deleteOne-comment.json | 66 + test/spec/crud/unified/deleteOne-comment.yml | 24 + .../deleteOne-hint-unacknowledged.json | 64 + test/spec/crud/unified/distinct-comment.json | 46 + test/spec/crud/unified/distinct-comment.yml | 25 + .../estimatedDocumentCount-comment.json | 46 + .../estimatedDocumentCount-comment.yml | 30 + .../find-allowdiskuse-serverError.json | 100 + .../unified/find-allowdiskuse-serverError.yml | 65 + test/spec/crud/unified/find-comment.json | 147 ++ test/spec/crud/unified/find-comment.yml | 60 + .../unified/findOneAndDelete-comment.json | 57 + .../crud/unified/findOneAndDelete-comment.yml | 23 + .../findOneAndDelete-hint-unacknowledged.json | 64 + .../unified/findOneAndReplace-comment.json | 62 + .../unified/findOneAndReplace-comment.yml | 25 + ...findOneAndReplace-hint-unacknowledged.json | 70 + .../unified/findOneAndUpdate-comment.json | 70 + .../crud/unified/findOneAndUpdate-comment.yml | 24 + .../findOneAndUpdate-hint-unacknowledged.json | 74 + .../spec/crud/unified/insertMany-comment.json | 60 + test/spec/crud/unified/insertMany-comment.yml | 24 + test/spec/crud/unified/insertOne-comment.json | 58 + test/spec/crud/unified/insertOne-comment.yml | 23 + .../spec/crud/unified/replaceOne-comment.json | 70 + test/spec/crud/unified/replaceOne-comment.yml | 28 + .../spec/crud/unified/updateMany-comment.json | 72 + test/spec/crud/unified/updateMany-comment.yml | 28 + test/spec/crud/unified/updateOne-comment.json | 74 + test/spec/crud/unified/updateOne-comment.yml | 28 + .../unified/insertOne-serverErrors.json | 303 +++ .../unified/serverMonitoringMode.json | 176 ++ 44 files changed, 4995 insertions(+), 1 deletion(-) create mode 100644 test/spec/crud/unified/find-allowdiskuse-serverError.json create mode 100644 test/spec/crud/unified/find-allowdiskuse-serverError.yml diff --git a/test/spec/change-streams/unified/change-streams-resume-allowlist.json b/test/spec/change-streams/unified/change-streams-resume-allowlist.json index a64b3d132c2..b4953ec736a 100644 --- a/test/spec/change-streams/unified/change-streams-resume-allowlist.json +++ b/test/spec/change-streams/unified/change-streams-resume-allowlist.json @@ -186,6 +186,2038 @@ } ] }, + { + "description": "change stream resumes after HostUnreachable", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 6, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after HostNotFound", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 7, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after NetworkTimeout", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 89, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after ShutdownInProgress", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 91, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after PrimarySteppedDown", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 189, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after ExceededTimeLimit", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 262, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after SocketException", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 9001, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after NotWritablePrimary", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 10107, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after InterruptedAtShutdown", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 11600, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after InterruptedDueToReplStateChange", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 11602, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after NotPrimaryNoSecondaryOk", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 13435, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after NotPrimaryOrSecondary", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 13436, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after StaleShardVersion", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 63, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after StaleEpoch", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 150, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after RetryChangeStream", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 234, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, + { + "description": "change stream resumes after FailedToSatisfyReadPreference", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "globalClient", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "getMore" + ], + "errorCode": 133, + "closeConnection": false + } + } + } + }, + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [] + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "globalCollection0", + "arguments": { + "document": { + "x": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0", + "expectResult": { + "_id": { + "$$exists": true + }, + "documentKey": { + "$$exists": true + }, + "operationType": "insert", + "ns": { + "db": "database0", + "coll": "collection0" + }, + "fullDocument": { + "x": 1, + "_id": { + "$$exists": true + } + } + } + } + ], + "expectEvents": [ + { + "client": "client0", + "ignoreExtraEvents": true, + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": {} + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$exists": true + }, + "collection": "collection0" + }, + "commandName": "getMore", + "databaseName": "database0" + } + }, + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "cursor": {}, + "pipeline": [ + { + "$changeStream": { + "resumeAfter": { + "$$unsetOrMatches": { + "$$exists": true + } + } + } + } + ] + }, + "commandName": "aggregate", + "databaseName": "database0" + } + } + ] + } + ] + }, { "description": "change stream resumes after CursorNotFound", "runOnRequirements": [ diff --git a/test/spec/change-streams/unified/change-streams.json b/test/spec/change-streams/unified/change-streams.json index 14349c3fb2d..a155d85b6e4 100644 --- a/test/spec/change-streams/unified/change-streams.json +++ b/test/spec/change-streams/unified/change-streams.json @@ -235,6 +235,51 @@ } ] }, + { + "description": "Test with document comment - pre 4.4", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "comment": { + "name": "test1" + } + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "pipeline": [ + { + "$changeStream": {} + } + ], + "comment": { + "name": "test1" + } + } + } + } + ] + } + ] + }, { "description": "Test with string comment", "operations": [ @@ -357,6 +402,90 @@ } ] }, + { + "description": "Test that comment is not set on getMore - pre 4.4", + "runOnRequirements": [ + { + "maxServerVersion": "4.3.99" + } + ], + "operations": [ + { + "name": "createChangeStream", + "object": "collection0", + "arguments": { + "pipeline": [], + "comment": "comment" + }, + "saveResultAsEntity": "changeStream0" + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 1, + "a": 1 + } + } + }, + { + "name": "iterateUntilDocumentOrError", + "object": "changeStream0" + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "collection0", + "pipeline": [ + { + "$changeStream": {} + } + ], + "comment": "comment" + } + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "collection0", + "documents": [ + { + "_id": 1, + "a": 1 + } + ] + } + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "collection0", + "comment": { + "$$exists": false + } + }, + "commandName": "getMore", + "databaseName": "database0" + } + } + ] + } + ] + }, { "description": "to field is set in a rename change event", "runOnRequirements": [ diff --git a/test/spec/change-streams/unified/change-streams.yml b/test/spec/change-streams/unified/change-streams.yml index 600b2ee2c13..7f824623a67 100644 --- a/test/spec/change-streams/unified/change-streams.yml +++ b/test/spec/change-streams/unified/change-streams.yml @@ -140,6 +140,27 @@ tests: - $changeStream: {} comment: *comment0 + - description: "Test with document comment - pre 4.4" + runOnRequirements: + - maxServerVersion: "4.2.99" + operations: + - name: createChangeStream + object: *collection0 + arguments: + pipeline: [] + comment: &comment0 { name: "test1" } + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0 + pipeline: + - $changeStream: {} + comment: *comment0 + - description: "Test with string comment" operations: - name: createChangeStream @@ -199,6 +220,46 @@ tests: commandName: getMore databaseName: *database0 + - description: "Test that comment is not set on getMore - pre 4.4" + runOnRequirements: + - maxServerVersion: "4.3.99" + operations: + - name: createChangeStream + object: *collection0 + arguments: + pipeline: [] + comment: "comment" + saveResultAsEntity: &changeStream0 changeStream0 + - name: insertOne + object: *collection0 + arguments: + document: &new_document + _id: 1 + a: 1 + - name: iterateUntilDocumentOrError + object: *changeStream0 + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0 + pipeline: + - $changeStream: {} + comment: "comment" + - commandStartedEvent: + command: + insert: *collection0 + documents: + - *new_document + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0 + comment: { $$exists: false } + commandName: getMore + databaseName: *database0 + - description: "to field is set in a rename change event" runOnRequirements: - minServerVersion: "4.0.1" diff --git a/test/spec/crud/unified/aggregate.json b/test/spec/crud/unified/aggregate.json index 7a783ca96ab..55634f05f60 100644 --- a/test/spec/crud/unified/aggregate.json +++ b/test/spec/crud/unified/aggregate.json @@ -266,6 +266,66 @@ } ] }, + { + "description": "aggregate with a document comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.6.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "aggregate", + "object": "collection0", + "arguments": { + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "comment": { + "content": "test" + } + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "comment": { + "content": "test" + } + }, + "commandName": "aggregate", + "databaseName": "aggregate-tests" + } + } + ] + } + ] + }, { "description": "aggregate with comment sets comment on getMore", "runOnRequirements": [ @@ -386,6 +446,123 @@ } ] }, + { + "description": "aggregate with comment does not set comment on getMore - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.6.0", + "maxServerVersion": "4.3.99" + } + ], + "operations": [ + { + "name": "aggregate", + "arguments": { + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "batchSize": 2, + "comment": "comment" + }, + "object": "collection0", + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "aggregate": "coll0", + "pipeline": [ + { + "$match": { + "_id": { + "$gt": 1 + } + } + } + ], + "cursor": { + "batchSize": 2 + }, + "comment": "comment" + }, + "commandName": "aggregate", + "databaseName": "aggregate-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2, + "comment": { + "$$exists": false + } + }, + "commandName": "getMore", + "databaseName": "aggregate-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2, + "comment": { + "$$exists": false + } + }, + "commandName": "getMore", + "databaseName": "aggregate-tests" + } + } + ] + } + ] + }, { "description": "Aggregate with multiple stages", "operations": [ diff --git a/test/spec/crud/unified/aggregate.yml b/test/spec/crud/unified/aggregate.yml index 58cf46a1cf1..6f99aaf0fe5 100644 --- a/test/spec/crud/unified/aggregate.yml +++ b/test/spec/crud/unified/aggregate.yml @@ -102,6 +102,29 @@ tests: pipeline: [ { $match: { _id: { $gt: 1 } } } ] comment: *comment0 + - description: "aggregate with a document comment - pre 4.4" + runOnRequirements: + - minServerVersion: "3.6.0" + maxServerVersion: "4.2.99" + operations: + - name: aggregate + object: *collection0 + arguments: + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + comment: *comment0 + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + comment: *comment0 + commandName: aggregate + databaseName: *database0Name + - description: "aggregate with comment sets comment on getMore" runOnRequirements: - minServerVersion: "4.4.0" @@ -145,6 +168,51 @@ tests: comment: *comment0 commandName: getMore databaseName: *database0Name + + - description: "aggregate with comment does not set comment on getMore - pre 4.4" + runOnRequirements: + - minServerVersion: "3.6.0" + maxServerVersion: "4.3.99" + operations: + - name: aggregate + arguments: + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + batchSize: 2 + comment: "comment" + object: *collection0 + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + aggregate: *collection0Name + pipeline: [ { $match: { _id: { $gt: 1 } }} ] + cursor: { batchSize: 2 } + comment: "comment" + commandName: aggregate + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + comment: { $$exists: false } + commandName: getMore + databaseName: *database0Name + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + comment: { $$exists: false } + commandName: getMore + databaseName: *database0Name - description: 'Aggregate with multiple stages' operations: diff --git a/test/spec/crud/unified/bulkWrite-comment.json b/test/spec/crud/unified/bulkWrite-comment.json index f918e785d17..0b2addc8505 100644 --- a/test/spec/crud/unified/bulkWrite-comment.json +++ b/test/spec/crud/unified/bulkWrite-comment.json @@ -407,6 +407,113 @@ ] } ] + }, + { + "description": "BulkWrite with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "insertOne": { + "document": { + "_id": 5, + "x": "inserted" + } + } + }, + { + "replaceOne": { + "filter": { + "_id": 1 + }, + "replacement": { + "_id": 1, + "x": "replaced" + } + } + }, + { + "updateOne": { + "filter": { + "_id": 2 + }, + "update": { + "$set": { + "x": "updated" + } + } + } + }, + { + "deleteOne": { + "filter": { + "_id": 3 + } + } + } + ], + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "BulkWrite_comment", + "documents": [ + { + "_id": 5, + "x": "inserted" + } + ], + "ordered": true, + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "BulkWrite_comment", + "databaseName": "crud-v2", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/bulkWrite-comment.yml b/test/spec/crud/unified/bulkWrite-comment.yml index 85db12c0f9d..965a0b8384b 100644 --- a/test/spec/crud/unified/bulkWrite-comment.yml +++ b/test/spec/crud/unified/bulkWrite-comment.yml @@ -148,4 +148,28 @@ tests: limit: 1 ordered: true comment: *document_comment - outcome: *outcome \ No newline at end of file + outcome: *outcome + + - description: 'BulkWrite with comment - pre 4.4' + runOnRequirements: + - minServerVersion: "3.4.0" + maxServerVersion: "4.2.99" + operations: + - object: *collection0 + name: bulkWrite + arguments: + requests: *requests + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + insert: *collection_name + documents: + - *inserted_document + ordered: true + comment: "comment" + outcome: *initial_data diff --git a/test/spec/crud/unified/bulkWrite-deleteMany-hint-unacknowledged.json b/test/spec/crud/unified/bulkWrite-deleteMany-hint-unacknowledged.json index a0aa297da18..2dda9486e88 100644 --- a/test/spec/crud/unified/bulkWrite-deleteMany-hint-unacknowledged.json +++ b/test/spec/crud/unified/bulkWrite-deleteMany-hint-unacknowledged.json @@ -51,6 +51,82 @@ } ], "tests": [ + { + "description": "Unacknowledged deleteMany with hint string fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteMany": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + } + } + ] + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Unacknowledged deleteMany with hint document fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteMany": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ] + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, { "description": "Unacknowledged deleteMany with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/bulkWrite-deleteOne-hint-unacknowledged.json b/test/spec/crud/unified/bulkWrite-deleteOne-hint-unacknowledged.json index 2e57fc74eb7..aadf6d9e991 100644 --- a/test/spec/crud/unified/bulkWrite-deleteOne-hint-unacknowledged.json +++ b/test/spec/crud/unified/bulkWrite-deleteOne-hint-unacknowledged.json @@ -47,6 +47,82 @@ } ], "tests": [ + { + "description": "Unacknowledged deleteOne with hint string fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteOne": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + } + } + ] + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Unacknowledged deleteOne with hint document fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "bulkWrite", + "arguments": { + "requests": [ + { + "deleteOne": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + } + } + ] + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, { "description": "Unacknowledged deleteOne with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/deleteMany-comment.json b/test/spec/crud/unified/deleteMany-comment.json index 1fadc035538..6abc5fd58a3 100644 --- a/test/spec/crud/unified/deleteMany-comment.json +++ b/test/spec/crud/unified/deleteMany-comment.json @@ -170,6 +170,76 @@ ] } ] + }, + { + "description": "deleteMany with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "deleteMany", + "object": "collection0", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "coll0", + "deletes": [ + { + "q": { + "_id": { + "$gt": 1 + } + }, + "limit": 0 + } + ], + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2, + "name": "name2" + }, + { + "_id": 3, + "name": "name3" + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/deleteMany-comment.yml b/test/spec/crud/unified/deleteMany-comment.yml index f2fae731b14..8f1b3522a76 100644 --- a/test/spec/crud/unified/deleteMany-comment.yml +++ b/test/spec/crud/unified/deleteMany-comment.yml @@ -71,3 +71,27 @@ tests: limit: 0 comment: *comment outcome: *outcome + + - description: "deleteMany with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "3.4.0" + maxServerVersion: "4.2.99" + operations: + - name: deleteMany + object: *collection0 + arguments: + filter: *filter + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + delete: *collection0Name + deletes: + - q: *filter + limit: 0 + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/deleteMany-hint-unacknowledged.json b/test/spec/crud/unified/deleteMany-hint-unacknowledged.json index d62b0db0357..ab7e9c7c094 100644 --- a/test/spec/crud/unified/deleteMany-hint-unacknowledged.json +++ b/test/spec/crud/unified/deleteMany-hint-unacknowledged.json @@ -51,6 +51,70 @@ } ], "tests": [ + { + "description": "Unacknowledged deleteMany with hint string fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Unacknowledged deleteMany with hint document fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "deleteMany", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, { "description": "Unacknowledged deleteMany with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/deleteOne-comment.json b/test/spec/crud/unified/deleteOne-comment.json index 36113b8db44..0f42b086a30 100644 --- a/test/spec/crud/unified/deleteOne-comment.json +++ b/test/spec/crud/unified/deleteOne-comment.json @@ -172,6 +172,72 @@ ] } ] + }, + { + "description": "deleteOne with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "deleteOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "delete": "coll0", + "deletes": [ + { + "q": { + "_id": 1 + }, + "limit": 1 + } + ], + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2, + "name": "name" + }, + { + "_id": 3, + "name": "name" + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/deleteOne-comment.yml b/test/spec/crud/unified/deleteOne-comment.yml index f23da349dce..1e52298f397 100644 --- a/test/spec/crud/unified/deleteOne-comment.yml +++ b/test/spec/crud/unified/deleteOne-comment.yml @@ -72,3 +72,27 @@ tests: limit: 1 comment: *comment outcome: *outcome + + - description: "deleteOne with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "3.4.0" + maxServerVersion: "4.2.99" + operations: + - name: deleteOne + object: *collection0 + arguments: + filter: *filter + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + delete: *collection0Name + deletes: + - q: *filter + limit: 1 + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/deleteOne-hint-unacknowledged.json b/test/spec/crud/unified/deleteOne-hint-unacknowledged.json index 8425194522d..1782f0f5251 100644 --- a/test/spec/crud/unified/deleteOne-hint-unacknowledged.json +++ b/test/spec/crud/unified/deleteOne-hint-unacknowledged.json @@ -47,6 +47,70 @@ } ], "tests": [ + { + "description": "Unacknowledged deleteOne with hint string fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Unacknowledged deleteOne with hint document fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "deleteOne", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, { "description": "Unacknowledged deleteOne with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/distinct-comment.json b/test/spec/crud/unified/distinct-comment.json index bb1274f122a..11bce9ac9d7 100644 --- a/test/spec/crud/unified/distinct-comment.json +++ b/test/spec/crud/unified/distinct-comment.json @@ -135,6 +135,52 @@ ] } ] + }, + { + "description": "distinct with document comment - pre 4.4, server error", + "runOnRequirements": [ + { + "minServerVersion": "3.6.0", + "maxServerVersion": "4.4.13" + } + ], + "operations": [ + { + "name": "distinct", + "object": "collection0", + "arguments": { + "fieldName": "x", + "filter": {}, + "comment": { + "key": "value" + } + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "distinct": "coll0", + "key": "x", + "query": {}, + "comment": { + "key": "value" + } + }, + "commandName": "distinct", + "databaseName": "distinct-comment-tests" + } + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/distinct-comment.yml b/test/spec/crud/unified/distinct-comment.yml index 4676b146dfc..c0820099431 100644 --- a/test/spec/crud/unified/distinct-comment.yml +++ b/test/spec/crud/unified/distinct-comment.yml @@ -71,3 +71,28 @@ tests: comment: *stringComment commandName: distinct databaseName: *database0Name + + - description: "distinct with document comment - pre 4.4, server error" + runOnRequirements: + - minServerVersion: "3.6.0" + maxServerVersion: "4.4.13" + operations: + - name: distinct + object: *collection0 + arguments: + fieldName: *fieldName + filter: *filter + comment: *documentComment + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + distinct: *collection0Name + key: *fieldName + query: *filter + comment: *documentComment + commandName: distinct + databaseName: *database0Name diff --git a/test/spec/crud/unified/estimatedDocumentCount-comment.json b/test/spec/crud/unified/estimatedDocumentCount-comment.json index 5a354a1570a..6c0adacc8f1 100644 --- a/test/spec/crud/unified/estimatedDocumentCount-comment.json +++ b/test/spec/crud/unified/estimatedDocumentCount-comment.json @@ -119,6 +119,52 @@ ] } ] + }, + { + "description": "estimatedDocumentCount with document comment - pre 4.4.14, server error", + "runOnRequirements": [ + { + "minServerVersion": "3.6.0", + "maxServerVersion": "4.4.13", + "topologies": [ + "single", + "replicaset" + ] + } + ], + "operations": [ + { + "name": "estimatedDocumentCount", + "object": "collection0", + "arguments": { + "comment": { + "key": "value" + } + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "count": "coll0", + "comment": { + "key": "value" + } + }, + "commandName": "count", + "databaseName": "edc-comment-tests" + } + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/estimatedDocumentCount-comment.yml b/test/spec/crud/unified/estimatedDocumentCount-comment.yml index 4f614d2ebe0..b7853151048 100644 --- a/test/spec/crud/unified/estimatedDocumentCount-comment.yml +++ b/test/spec/crud/unified/estimatedDocumentCount-comment.yml @@ -63,3 +63,33 @@ tests: comment: *stringComment commandName: count databaseName: *database0Name + + - description: "estimatedDocumentCount with document comment - pre 4.4.14, server error" + runOnRequirements: + - minServerVersion: "3.6.0" + maxServerVersion: "4.4.13" + # Server does not raise an error if topology is sharded. + # https://jira.mongodb.org/browse/SERVER-65954 + topologies: [ single, replicaset ] + operations: + - name: estimatedDocumentCount + object: *collection0 + arguments: + # Even though according to the docs count command does not support any + # comment for server version less than 4.4, no error is raised by such + # servers. Therefore, we have only one test with a document comment + # to test server errors. + # https://jira.mongodb.org/browse/SERVER-63315 + # Server supports count with comment of any type for comment starting from 4.4.14. + comment: *documentComment + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + count: *collection0Name + comment: *documentComment + commandName: count + databaseName: *database0Name diff --git a/test/spec/crud/unified/find-allowdiskuse-serverError.json b/test/spec/crud/unified/find-allowdiskuse-serverError.json new file mode 100644 index 00000000000..dc58f8f0e3a --- /dev/null +++ b/test/spec/crud/unified/find-allowdiskuse-serverError.json @@ -0,0 +1,100 @@ +{ + "description": "find-allowdiskuse-serverError", + "schemaVersion": "1.0", + "runOnRequirements": [ + { + "minServerVersion": "3.2", + "maxServerVersion": "4.3.0" + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "crud-v2" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "test_find_allowdiskuse_servererror" + } + } + ], + "tests": [ + { + "description": "Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": true + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse_servererror", + "filter": {}, + "allowDiskUse": true + } + } + } + ] + } + ] + }, + { + "description": "Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)", + "operations": [ + { + "object": "collection0", + "name": "find", + "arguments": { + "filter": {}, + "allowDiskUse": false + }, + "expectError": { + "isError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "test_find_allowdiskuse_servererror", + "filter": {}, + "allowDiskUse": false + } + } + } + ] + } + ] + } + ] +} diff --git a/test/spec/crud/unified/find-allowdiskuse-serverError.yml b/test/spec/crud/unified/find-allowdiskuse-serverError.yml new file mode 100644 index 00000000000..86f48d18e58 --- /dev/null +++ b/test/spec/crud/unified/find-allowdiskuse-serverError.yml @@ -0,0 +1,65 @@ +description: find-allowdiskuse-serverError +schemaVersion: '1.0' +runOnRequirements: + - + minServerVersion: '3.2' + maxServerVersion: 4.3.0 +createEntities: + - + client: + id: &client0 client0 + observeEvents: + - commandStartedEvent + - + database: + id: &database0 database0 + client: client0 + databaseName: &database_name crud-v2 + - + collection: + id: &collection0 collection0 + database: database0 + collectionName: &collection_name test_find_allowdiskuse_servererror +tests: + - + description: 'Find fails when allowDiskUse true is specified against pre 4.4 server (server-side error)' + operations: + - + object: *collection0 + name: find + arguments: + filter: &filter { } + allowDiskUse: true + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + filter: *filter + allowDiskUse: true + - + description: 'Find fails when allowDiskUse false is specified against pre 4.4 server (server-side error)' + operations: + - + object: *collection0 + name: find + arguments: + filter: *filter + allowDiskUse: false + expectError: + isError: true + expectEvents: + - + client: *client0 + events: + - + commandStartedEvent: + command: + find: *collection_name + filter: *filter + allowDiskUse: false diff --git a/test/spec/crud/unified/find-comment.json b/test/spec/crud/unified/find-comment.json index d7771b8d733..600a3723f15 100644 --- a/test/spec/crud/unified/find-comment.json +++ b/test/spec/crud/unified/find-comment.json @@ -148,6 +148,52 @@ } ] }, + { + "description": "find with document comment - pre 4.4", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99", + "minServerVersion": "3.6" + } + ], + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "comment": { + "key": "value" + } + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": { + "_id": 1 + }, + "comment": { + "key": "value" + } + } + } + } + ] + } + ] + }, { "description": "find with comment sets comment on getMore", "runOnRequirements": [ @@ -251,6 +297,107 @@ ] } ] + }, + { + "description": "find with comment does not set comment on getMore - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.6.0", + "maxServerVersion": "4.3.99" + } + ], + "operations": [ + { + "name": "find", + "object": "collection0", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2, + "comment": "comment" + }, + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + }, + { + "_id": 4, + "x": 44 + }, + { + "_id": 5, + "x": 55 + }, + { + "_id": 6, + "x": 66 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "coll0", + "filter": { + "_id": { + "$gt": 1 + } + }, + "batchSize": 2, + "comment": "comment" + } + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2, + "comment": { + "$$exists": false + } + } + } + }, + { + "commandStartedEvent": { + "command": { + "getMore": { + "$$type": [ + "int", + "long" + ] + }, + "collection": "coll0", + "batchSize": 2, + "comment": { + "$$exists": false + } + } + } + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/find-comment.yml b/test/spec/crud/unified/find-comment.yml index 99dfed19bbf..905241ad0e9 100644 --- a/test/spec/crud/unified/find-comment.yml +++ b/test/spec/crud/unified/find-comment.yml @@ -67,6 +67,27 @@ tests: filter: *filter comment: *comment + - description: "find with document comment - pre 4.4" + runOnRequirements: + - maxServerVersion: "4.2.99" + minServerVersion: "3.6" + operations: + - name: find + object: *collection0 + arguments: + filter: *filter + comment: *comment + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: *filter + comment: *comment + - description: "find with comment sets comment on getMore" runOnRequirements: - minServerVersion: "4.4.0" @@ -104,3 +125,42 @@ tests: collection: *collection0Name batchSize: 2 comment: *comment + + - description: "find with comment does not set comment on getMore - pre 4.4" + runOnRequirements: + - minServerVersion: "3.6.0" + maxServerVersion: "4.3.99" + operations: + - name: find + object: *collection0 + arguments: + filter: &filter_get_more { _id: { $gt: 1 } } + batchSize: 2 + comment: "comment" + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + - { _id: 4, x: 44 } + - { _id: 5, x: 55 } + - { _id: 6, x: 66 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: { _id: { $gt: 1 } } + batchSize: 2 + comment: "comment" + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + comment: { $$exists: false } + - commandStartedEvent: + command: + getMore: { $$type: [ int, long ] } + collection: *collection0Name + batchSize: 2 + comment: { $$exists: false } diff --git a/test/spec/crud/unified/findOneAndDelete-comment.json b/test/spec/crud/unified/findOneAndDelete-comment.json index ed51f55b5f5..6853b9cc2d7 100644 --- a/test/spec/crud/unified/findOneAndDelete-comment.json +++ b/test/spec/crud/unified/findOneAndDelete-comment.json @@ -149,6 +149,63 @@ ] } ] + }, + { + "description": "findOneAndDelete with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "findOneAndDelete", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "coll0", + "query": { + "_id": 1 + }, + "remove": true, + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/findOneAndDelete-comment.yml b/test/spec/crud/unified/findOneAndDelete-comment.yml index 322719a0c83..dfa7ff2ce0a 100644 --- a/test/spec/crud/unified/findOneAndDelete-comment.yml +++ b/test/spec/crud/unified/findOneAndDelete-comment.yml @@ -71,3 +71,26 @@ tests: remove: true comment: *comment outcome: *outcome + + - description: "findOneAndDelete with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "4.2.0" # findAndModify option validation was introduced in 4.2 + maxServerVersion: "4.2.99" + operations: + - name: findOneAndDelete + object: *collection0 + arguments: + filter: *filter + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + findAndModify: *collection0Name + query: *filter + remove: true + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.json b/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.json index d6e51186db2..077f9892b93 100644 --- a/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.json +++ b/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.json @@ -47,6 +47,70 @@ } ], "tests": [ + { + "description": "Unacknowledged findOneAndDelete with hint string fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Unacknowledged findOneAndDelete with hint document fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "findOneAndDelete", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, { "description": "Unacknowledged findOneAndDelete with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/findOneAndReplace-comment.json b/test/spec/crud/unified/findOneAndReplace-comment.json index 868405ce7e9..f817bb69375 100644 --- a/test/spec/crud/unified/findOneAndReplace-comment.json +++ b/test/spec/crud/unified/findOneAndReplace-comment.json @@ -167,6 +167,68 @@ ] } ] + }, + { + "description": "findOneAndReplace with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "findOneAndReplace", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 5 + }, + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "coll0", + "query": { + "_id": 1 + }, + "update": { + "x": 5 + }, + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/findOneAndReplace-comment.yml b/test/spec/crud/unified/findOneAndReplace-comment.yml index ed939b986ed..2c6aaef07ba 100644 --- a/test/spec/crud/unified/findOneAndReplace-comment.yml +++ b/test/spec/crud/unified/findOneAndReplace-comment.yml @@ -74,3 +74,28 @@ tests: update: *replacement comment: *comment outcome: *outcome + + + - description: "findOneAndReplace with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "4.2.0" # findAndModify option validation was introduced in 4.2 + maxServerVersion: "4.2.99" + operations: + - name: findOneAndReplace + object: *collection0 + arguments: + filter: *filter + replacement: *replacement + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + findAndModify: *collection0Name + query: *filter + update: *replacement + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/findOneAndReplace-hint-unacknowledged.json b/test/spec/crud/unified/findOneAndReplace-hint-unacknowledged.json index f2aa892b4d2..8228d8a2aa9 100644 --- a/test/spec/crud/unified/findOneAndReplace-hint-unacknowledged.json +++ b/test/spec/crud/unified/findOneAndReplace-hint-unacknowledged.json @@ -54,6 +54,76 @@ } ], "tests": [ + { + "description": "Unacknowledged findOneAndReplace with hint string fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": "_id_" + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Unacknowledged findOneAndReplace with hint document fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "findOneAndReplace", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "replacement": { + "x": 111 + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, { "description": "Unacknowledged findOneAndReplace with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/findOneAndUpdate-comment.json b/test/spec/crud/unified/findOneAndUpdate-comment.json index 2759e65321c..6dec5b39eee 100644 --- a/test/spec/crud/unified/findOneAndUpdate-comment.json +++ b/test/spec/crud/unified/findOneAndUpdate-comment.json @@ -153,6 +153,76 @@ ] } ] + }, + { + "description": "findOneAndUpdate with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "4.2.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "findOneAndUpdate", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": [ + { + "$set": { + "x": 5 + } + } + ], + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "findAndModify": "coll0", + "query": { + "_id": 1 + }, + "update": [ + { + "$set": { + "x": 5 + } + } + ], + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1 + }, + { + "_id": 2 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/findOneAndUpdate-comment.yml b/test/spec/crud/unified/findOneAndUpdate-comment.yml index 37c5f518ec1..66d2d099c1d 100644 --- a/test/spec/crud/unified/findOneAndUpdate-comment.yml +++ b/test/spec/crud/unified/findOneAndUpdate-comment.yml @@ -69,3 +69,27 @@ tests: query: *filter update: *update comment: *comment + + - description: "findOneAndUpdate with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "4.2.0" # findAndModify option validation was introduced in 4.2 + maxServerVersion: "4.2.99" + operations: + - name: findOneAndUpdate + object: *collection0 + arguments: + filter: *filter + update: *update + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + findAndModify: *collection0Name + query: *filter + update: *update + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/findOneAndUpdate-hint-unacknowledged.json b/test/spec/crud/unified/findOneAndUpdate-hint-unacknowledged.json index 7759577b7c4..d116a06d0d0 100644 --- a/test/spec/crud/unified/findOneAndUpdate-hint-unacknowledged.json +++ b/test/spec/crud/unified/findOneAndUpdate-hint-unacknowledged.json @@ -47,6 +47,80 @@ } ], "tests": [ + { + "description": "Unacknowledged findOneAndUpdate with hint string fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": "_id_" + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, + { + "description": "Unacknowledged findOneAndUpdate with hint document fails with client-side error on pre-4.4 server", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "object": "collection0", + "name": "findOneAndUpdate", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + }, + "update": { + "$inc": { + "x": 1 + } + }, + "hint": { + "_id": 1 + } + }, + "expectError": { + "isClientError": true + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [] + } + ] + }, { "description": "Unacknowledged findOneAndUpdate with hint string on 4.4+ server", "runOnRequirements": [ diff --git a/test/spec/crud/unified/insertMany-comment.json b/test/spec/crud/unified/insertMany-comment.json index 46916c9f861..2b4c80b3f06 100644 --- a/test/spec/crud/unified/insertMany-comment.json +++ b/test/spec/crud/unified/insertMany-comment.json @@ -161,6 +161,66 @@ ] } ] + }, + { + "description": "insertMany with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "insertMany", + "object": "collection0", + "arguments": { + "documents": [ + { + "_id": 2, + "x": 22 + } + ], + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll0", + "documents": [ + { + "_id": 2, + "x": 22 + } + ], + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/insertMany-comment.yml b/test/spec/crud/unified/insertMany-comment.yml index 58176897ef8..4b51584df2b 100644 --- a/test/spec/crud/unified/insertMany-comment.yml +++ b/test/spec/crud/unified/insertMany-comment.yml @@ -67,3 +67,27 @@ tests: - *document comment: *comment outcome: *outcome + + - description: "insertMany with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "3.4.0" + maxServerVersion: "4.2.99" + operations: + - name: insertMany + object: *collection0 + arguments: + documents: + - *document + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + insert: *collection0Name + documents: + - *document + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/insertOne-comment.json b/test/spec/crud/unified/insertOne-comment.json index 0e34aea80ac..dbd83d9f642 100644 --- a/test/spec/crud/unified/insertOne-comment.json +++ b/test/spec/crud/unified/insertOne-comment.json @@ -157,6 +157,64 @@ ] } ] + }, + { + "description": "insertOne with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 2, + "x": 22 + }, + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll0", + "documents": [ + { + "_id": 2, + "x": 22 + } + ], + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/insertOne-comment.yml b/test/spec/crud/unified/insertOne-comment.yml index 309d81b696f..f8cb60ce85a 100644 --- a/test/spec/crud/unified/insertOne-comment.yml +++ b/test/spec/crud/unified/insertOne-comment.yml @@ -66,3 +66,26 @@ tests: - *document comment: *comment outcome: *outcome + + - description: "insertOne with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "3.4.0" + maxServerVersion: "4.2.99" + operations: + - name: insertOne + object: *collection0 + arguments: + document: *document + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + insert: *collection0Name + documents: + - *document + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/replaceOne-comment.json b/test/spec/crud/unified/replaceOne-comment.json index 8215445a252..88bee5d7b7a 100644 --- a/test/spec/crud/unified/replaceOne-comment.json +++ b/test/spec/crud/unified/replaceOne-comment.json @@ -173,6 +173,76 @@ ] } ] + }, + { + "description": "ReplaceOne with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "replaceOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "replacement": { + "x": 22 + }, + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "coll0", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "x": 22 + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/replaceOne-comment.yml b/test/spec/crud/unified/replaceOne-comment.yml index ef186008ab7..2c22b287572 100644 --- a/test/spec/crud/unified/replaceOne-comment.yml +++ b/test/spec/crud/unified/replaceOne-comment.yml @@ -75,3 +75,31 @@ tests: upsert: { $$unsetOrMatches: false } comment: *comment outcome: *outcome + + - description: "ReplaceOne with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "3.4.0" + maxServerVersion: "4.2.99" + operations: + - name: replaceOne + object: *collection0 + arguments: + filter: *filter + replacement: *replacement + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + update: *collection0Name + updates: + - + q: *filter + u: *replacement + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/updateMany-comment.json b/test/spec/crud/unified/updateMany-comment.json index 99e1ad15b2d..88b8b67f5a1 100644 --- a/test/spec/crud/unified/updateMany-comment.json +++ b/test/spec/crud/unified/updateMany-comment.json @@ -177,6 +177,78 @@ ] } ] + }, + { + "description": "UpdateMany with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "updateMany", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "x": 22 + } + }, + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "coll0", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$set": { + "x": 22 + } + }, + "multi": true, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/updateMany-comment.yml b/test/spec/crud/unified/updateMany-comment.yml index 0a9283aeab1..4c6fbacd771 100644 --- a/test/spec/crud/unified/updateMany-comment.yml +++ b/test/spec/crud/unified/updateMany-comment.yml @@ -74,3 +74,31 @@ tests: upsert: { $$unsetOrMatches: false } comment: *comment outcome: *outcome + + - description: "UpdateMany with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "3.4.0" + maxServerVersion: "4.2.99" + operations: + - name: updateMany + object: *collection0 + arguments: + filter: *filter + update: *update + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + update: *collection0Name + updates: + - + q: *filter + u: *update + multi: true + upsert: { $$unsetOrMatches: false } + comment: "comment" + outcome: *initialData diff --git a/test/spec/crud/unified/updateOne-comment.json b/test/spec/crud/unified/updateOne-comment.json index 02ab02e0480..f4ee74db38b 100644 --- a/test/spec/crud/unified/updateOne-comment.json +++ b/test/spec/crud/unified/updateOne-comment.json @@ -181,6 +181,80 @@ ] } ] + }, + { + "description": "UpdateOne with comment - pre 4.4", + "runOnRequirements": [ + { + "minServerVersion": "3.4.0", + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "updateOne", + "object": "collection0", + "arguments": { + "filter": { + "_id": 1 + }, + "update": { + "$set": { + "x": 22 + } + }, + "comment": "comment" + }, + "expectError": { + "isClientError": false + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "update": "coll0", + "updates": [ + { + "q": { + "_id": 1 + }, + "u": { + "$set": { + "x": 22 + } + }, + "multi": { + "$$unsetOrMatches": false + }, + "upsert": { + "$$unsetOrMatches": false + } + } + ], + "comment": "comment" + } + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll0", + "databaseName": "crud-tests", + "documents": [ + { + "_id": 1, + "x": 11 + } + ] + } + ] } ] } diff --git a/test/spec/crud/unified/updateOne-comment.yml b/test/spec/crud/unified/updateOne-comment.yml index d549c3adaa1..a176d620ebd 100644 --- a/test/spec/crud/unified/updateOne-comment.yml +++ b/test/spec/crud/unified/updateOne-comment.yml @@ -74,3 +74,31 @@ tests: upsert: { $$unsetOrMatches: false } comment: *comment outcome: *outcome + + - description: "UpdateOne with comment - pre 4.4" + runOnRequirements: + - minServerVersion: "3.4.0" + maxServerVersion: "4.2.99" + operations: + - name: updateOne + object: *collection0 + arguments: + filter: *filter + update: *update + comment: "comment" + expectError: + isClientError: false + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + update: *collection0Name + updates: + - + q: *filter + u: *update + multi: { $$unsetOrMatches: false } + upsert: { $$unsetOrMatches: false } + comment: "comment" + outcome: *initialData diff --git a/test/spec/retryable-writes/unified/insertOne-serverErrors.json b/test/spec/retryable-writes/unified/insertOne-serverErrors.json index 01f5e387289..8edafb7029b 100644 --- a/test/spec/retryable-writes/unified/insertOne-serverErrors.json +++ b/test/spec/retryable-writes/unified/insertOne-serverErrors.json @@ -167,6 +167,309 @@ } ] }, + { + "description": "RetryableWriteError label is added based on top-level code in pre-4.4 server response", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99", + "topologies": [ + "replicaset", + "sharded" + ] + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "insert" + ], + "errorCode": 189 + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 3, + "x": 33 + } + }, + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll", + "documents": [ + { + "_id": 3, + "x": 33 + } + ] + }, + "commandName": "insert", + "databaseName": "retryable-writes-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "coll", + "documents": [ + { + "_id": 3, + "x": 33 + } + ] + }, + "commandName": "insert", + "databaseName": "retryable-writes-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll", + "databaseName": "retryable-writes-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + } + ] + } + ] + }, + { + "description": "RetryableWriteError label is added based on writeConcernError in pre-4.4 mongod response", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99", + "topologies": [ + "replicaset" + ] + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 2 + }, + "data": { + "failCommands": [ + "insert" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 3, + "x": 33 + } + }, + "expectError": { + "errorLabelsContain": [ + "RetryableWriteError" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll", + "documents": [ + { + "_id": 3, + "x": 33 + } + ] + }, + "commandName": "insert", + "databaseName": "retryable-writes-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "insert": "coll", + "documents": [ + { + "_id": 3, + "x": 33 + } + ] + }, + "commandName": "insert", + "databaseName": "retryable-writes-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll", + "databaseName": "retryable-writes-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, + { + "description": "RetryableWriteError label is not added based on writeConcernError in pre-4.4 mongos response", + "runOnRequirements": [ + { + "minServerVersion": "4.2", + "maxServerVersion": "4.2.99", + "topologies": [ + "sharded" + ] + } + ], + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "insert" + ], + "writeConcernError": { + "code": 91, + "errmsg": "Replication is being shut down" + } + } + } + } + }, + { + "name": "insertOne", + "object": "collection0", + "arguments": { + "document": { + "_id": 3, + "x": 33 + } + }, + "expectError": { + "errorLabelsOmit": [ + "RetryableWriteError" + ] + } + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "insert": "coll", + "documents": [ + { + "_id": 3, + "x": 33 + } + ] + }, + "commandName": "insert", + "databaseName": "retryable-writes-tests" + } + } + ] + } + ], + "outcome": [ + { + "collectionName": "coll", + "databaseName": "retryable-writes-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ] + }, { "description": "InsertOne succeeds after connection failure", "operations": [ diff --git a/test/spec/server-discovery-and-monitoring/unified/serverMonitoringMode.json b/test/spec/server-discovery-and-monitoring/unified/serverMonitoringMode.json index 970d4a0f9bd..7d681b4f9ec 100644 --- a/test/spec/server-discovery-and-monitoring/unified/serverMonitoringMode.json +++ b/test/spec/server-discovery-and-monitoring/unified/serverMonitoringMode.json @@ -99,6 +99,94 @@ } ] }, + { + "description": "connect with serverMonitoringMode=auto <4.4", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "createEntities", + "object": "testRunner", + "arguments": { + "entities": [ + { + "client": { + "id": "client", + "uriOptions": { + "serverMonitoringMode": "auto", + "heartbeatFrequencyMS": 500 + }, + "useMultipleMongoses": false, + "observeEvents": [ + "serverHeartbeatStartedEvent", + "serverHeartbeatSucceededEvent", + "serverHeartbeatFailedEvent" + ] + } + }, + { + "database": { + "id": "db", + "client": "client", + "databaseName": "sdam-tests" + } + } + ] + } + }, + { + "name": "runCommand", + "object": "db", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + }, + "expectResult": { + "ok": 1 + } + }, + { + "name": "waitForEvent", + "object": "testRunner", + "arguments": { + "client": "client", + "event": { + "serverHeartbeatStartedEvent": {} + }, + "count": 2 + } + } + ], + "expectEvents": [ + { + "client": "client", + "eventType": "sdam", + "ignoreExtraEvents": true, + "events": [ + { + "serverHeartbeatStartedEvent": { + "awaited": false + } + }, + { + "serverHeartbeatSucceededEvent": { + "awaited": false + } + }, + { + "serverHeartbeatStartedEvent": { + "awaited": false + } + } + ] + } + ] + }, { "description": "connect with serverMonitoringMode=stream >=4.4", "runOnRequirements": [ @@ -186,6 +274,94 @@ } ] }, + { + "description": "connect with serverMonitoringMode=stream <4.4", + "runOnRequirements": [ + { + "maxServerVersion": "4.2.99" + } + ], + "operations": [ + { + "name": "createEntities", + "object": "testRunner", + "arguments": { + "entities": [ + { + "client": { + "id": "client", + "uriOptions": { + "serverMonitoringMode": "stream", + "heartbeatFrequencyMS": 500 + }, + "useMultipleMongoses": false, + "observeEvents": [ + "serverHeartbeatStartedEvent", + "serverHeartbeatSucceededEvent", + "serverHeartbeatFailedEvent" + ] + } + }, + { + "database": { + "id": "db", + "client": "client", + "databaseName": "sdam-tests" + } + } + ] + } + }, + { + "name": "runCommand", + "object": "db", + "arguments": { + "commandName": "ping", + "command": { + "ping": 1 + } + }, + "expectResult": { + "ok": 1 + } + }, + { + "name": "waitForEvent", + "object": "testRunner", + "arguments": { + "client": "client", + "event": { + "serverHeartbeatStartedEvent": {} + }, + "count": 2 + } + } + ], + "expectEvents": [ + { + "client": "client", + "eventType": "sdam", + "ignoreExtraEvents": true, + "events": [ + { + "serverHeartbeatStartedEvent": { + "awaited": false + } + }, + { + "serverHeartbeatSucceededEvent": { + "awaited": false + } + }, + { + "serverHeartbeatStartedEvent": { + "awaited": false + } + } + ] + } + ] + }, { "description": "connect with serverMonitoringMode=poll", "operations": [ From f1ae0daf05606c052db260b9ad062fe73e151ca0 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 14 Jul 2026 15:28:49 -0400 Subject: [PATCH 07/38] test: bump mock server version --- test/tools/mongodb-mock/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/tools/mongodb-mock/index.js b/test/tools/mongodb-mock/index.js index 11427450f77..5e1976f0b9c 100644 --- a/test/tools/mongodb-mock/index.js +++ b/test/tools/mongodb-mock/index.js @@ -18,8 +18,8 @@ const DEFAULT_HELLO = { ok: 1 }; -const DEFAULT_HELLO_42 = Object.assign({}, DEFAULT_HELLO, { - maxWireVersion: 8, +const DEFAULT_HELLO_44 = Object.assign({}, DEFAULT_HELLO, { + maxWireVersion: 9, logicalSessionTimeoutMinutes: 10 }); @@ -93,5 +93,5 @@ function cleanup(spy, callback) { module.exports = { createServer, cleanup, - HELLO: DEFAULT_HELLO_42 + HELLO: DEFAULT_HELLO_44 }; From 08ecce72f0f0a7015e31a14b969ff1d25cf77033 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 14 Jul 2026 16:50:39 -0400 Subject: [PATCH 08/38] fix: case affine to v4.2 --- src/operations/find_and_modify.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/operations/find_and_modify.ts b/src/operations/find_and_modify.ts index e4fd97164c2..3a57c05bddb 100644 --- a/src/operations/find_and_modify.ts +++ b/src/operations/find_and_modify.ts @@ -191,13 +191,6 @@ export class FindAndModifyOperation extends CommandOperation { decorateWithCollation(command, options); if (options.hint) { - const unacknowledgedWrite = this.writeConcern?.w === 0; - if (unacknowledgedWrite) { - throw new MongoCompatibilityError( - 'hint for the findAndModify command is only supported on MongoDB 4.4+' - ); - } - command.hint = options.hint; } From 329756791d1630a337e7482947f5cea7ebbaee69 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 14 Jul 2026 18:13:14 -0400 Subject: [PATCH 09/38] chore: lint --- src/operations/find_and_modify.ts | 2 +- test/integration/change-streams/change_stream.test.ts | 2 +- test/integration/crud/find.test.ts | 9 +-------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/operations/find_and_modify.ts b/src/operations/find_and_modify.ts index 3a57c05bddb..32f16584ed6 100644 --- a/src/operations/find_and_modify.ts +++ b/src/operations/find_and_modify.ts @@ -2,7 +2,7 @@ import { type Connection } from '..'; import type { Document } from '../bson'; import { MongoDBResponse } from '../cmap/wire_protocol/responses'; import type { Collection } from '../collection'; -import { MongoCompatibilityError, MongoInvalidArgumentError } from '../error'; +import { MongoInvalidArgumentError } from '../error'; import { ReadPreference } from '../read_preference'; import type { ClientSession } from '../sessions'; import { formatSort, type Sort, type SortForCmd } from '../sort'; diff --git a/test/integration/change-streams/change_stream.test.ts b/test/integration/change-streams/change_stream.test.ts index f4f705ee5ff..0e7f144de88 100644 --- a/test/integration/change-streams/change_stream.test.ts +++ b/test/integration/change-streams/change_stream.test.ts @@ -2,7 +2,7 @@ import { strict as assert } from 'assert'; import { Long, UUID } from 'bson'; import { expect } from 'chai'; import { on, once } from 'events'; -import { gte, lt } from 'semver'; +import { gte } from 'semver'; import * as sinon from 'sinon'; import { PassThrough } from 'stream'; import { setTimeout } from 'timers'; diff --git a/test/integration/crud/find.test.ts b/test/integration/crud/find.test.ts index 60890f2bfa1..2b24254e2db 100644 --- a/test/integration/crud/find.test.ts +++ b/test/integration/crud/find.test.ts @@ -1,14 +1,7 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; -import { - Code, - Long, - type MongoClient, - MongoServerError, - ObjectId, - ReturnDocument -} from '../../mongodb'; +import { Long, type MongoClient, MongoServerError, ObjectId, ReturnDocument } from '../../mongodb'; import { assert as test, filterForCommands } from '../shared'; describe('Find', function () { From a29d3b99bc4f026cc3900379bc42a1895519b860 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 14 Jul 2026 18:45:39 -0400 Subject: [PATCH 10/38] chore: remove test instrumentation for v4.2 (config generation) --- .evergreen/ci_matrix_constants.js | 2 +- .evergreen/generate_evergreen_tasks.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/ci_matrix_constants.js b/.evergreen/ci_matrix_constants.js index 1b38ceabefb..b4cc9d43ccc 100644 --- a/.evergreen/ci_matrix_constants.js +++ b/.evergreen/ci_matrix_constants.js @@ -1,4 +1,4 @@ -const MONGODB_VERSIONS = ['latest', 'rapid', '8.0', '7.0', '6.0', '5.0', '4.4', '4.2']; +const MONGODB_VERSIONS = ['latest', 'rapid', '8.0', '7.0', '6.0', '5.0', '4.4']; const versions = [ { codeName: 'iron', versionNumber: '20.19.0' }, { codeName: 'jod', versionNumber: 22 }, diff --git a/.evergreen/generate_evergreen_tasks.js b/.evergreen/generate_evergreen_tasks.js index db577a148b0..c3655852572 100644 --- a/.evergreen/generate_evergreen_tasks.js +++ b/.evergreen/generate_evergreen_tasks.js @@ -424,7 +424,7 @@ for (const { // Running CSFLE tests with mongocryptd const MONGOCRYPTD_CSFLE_TASKS = MONGODB_VERSIONS.filter( mongoVersion => - ['latest', 'rapid'].includes(mongoVersion) || semver.gte(`${mongoVersion}.0`, '4.2.0') + ['latest', 'rapid'].includes(mongoVersion) || semver.gte(`${mongoVersion}.0`, '4.4.0') ).map(mongoVersion => { return { name: `test-${mongoVersion}-csfle-mongocryptd`, From 531f4879e3f0239d783d374aa2102c8811b6ce77 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Wed, 15 Jul 2026 11:22:55 -0400 Subject: [PATCH 11/38] fix: isRetryableWriteError() check not relevant to v4.4 --- src/error.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/error.ts b/src/error.ts index e442fefd86d..c401915ba97 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1400,7 +1400,7 @@ export function needsRetryableWriteLabel(error: Error): boolean { return true; } if (error instanceof MongoError) { - if (isRetryableWriteError(error) && !error.hasErrorLabel(MongoErrorLabel.HandshakeError)) { + if (!error.hasErrorLabel(MongoErrorLabel.HandshakeError)) { // If we already have the error label no need to add it again. 4.4+ servers add the label. // In the case where we have a handshake error, need to fall down to the logic checking // the codes. From fdf03bdad90bd4e7880746c6b88546ca74af6606 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Wed, 15 Jul 2026 11:57:26 -0400 Subject: [PATCH 12/38] revert: unified spec test changes --- .../findOneAndDelete-hint-unacknowledged.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.yml b/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.yml index bb39b9b3c5b..2b29a4923ea 100644 --- a/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.yml +++ b/test/spec/crud/unified/findOneAndDelete-hint-unacknowledged.yml @@ -26,6 +26,34 @@ initialData: - { _id: 2, x: 22 } tests: + - description: "Unacknowledged findOneAndDelete with hint string fails with client-side error on pre-4.4 server" + runOnRequirements: + - maxServerVersion: "4.2.99" + operations: + - object: *collection0 + name: findOneAndDelete + arguments: + filter: &filter { _id: { $gt: 1 } } + hint: _id_ + expectError: + isClientError: true + expectEvents: &noEvents + - client: *client0 + events: [] + + - description: "Unacknowledged findOneAndDelete with hint document fails with client-side error on pre-4.4 server" + runOnRequirements: + - maxServerVersion: "4.2.99" + operations: + - object: *collection0 + name: findOneAndDelete + arguments: + filter: *filter + hint: { _id: 1 } + expectError: + isClientError: true + expectEvents: *noEvents + - description: "Unacknowledged findOneAndDelete with hint string on 4.4+ server" runOnRequirements: - minServerVersion: "4.4.0" From 8e3ccb83069a6cfffbd9e23248a0c26970371fec Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Wed, 15 Jul 2026 15:33:43 -0400 Subject: [PATCH 13/38] test: remove dead test --- test/unit/operations/list_collections.test.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/test/unit/operations/list_collections.test.js b/test/unit/operations/list_collections.test.js index 927f94a725f..af0e9901234 100644 --- a/test/unit/operations/list_collections.test.js +++ b/test/unit/operations/list_collections.test.js @@ -68,20 +68,6 @@ describe('ListCollectionsOperation', function () { const description = new StreamDescription(); context('when comment is provided', function () { - context('when the wireVersion < 9', function () { - it('does not set a comment on the command', function () { - const operation = new ListCollectionsOperation( - db, - {}, - { dbName: db, comment: 'test comment' } - ); - description.maxWireVersion = 8; - const command = operation.buildCommandDocument({ - description - }); - expect(command).not.to.haveOwnProperty('comment'); - }); - }); context('when the wireVersion >= 9', function () { it('sets a comment on the command', function () { From 0426466d355513b553a6df4aa87db5dde589b3ac Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Wed, 15 Jul 2026 18:15:23 -0400 Subject: [PATCH 14/38] test: skip 4.2 legacy tests with outdated templates --- ...rver_discovery_and_monitoring.spec.test.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts b/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts index c9abe0e5a4d..25afb24b43b 100644 --- a/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts +++ b/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts @@ -191,6 +191,20 @@ function assertMonitoringOutcome(outcome: any): asserts outcome is MonitoringOut expect(outcome).to.have.property('events').that.is.an('array'); } +// These tests assert on Post-4.2 error handling using servers that report wire version 8 +// (MongoDB 4.2), which is below the driver's minimum supported wire version of 9 (MongoDB 4.4). +// As a result the topology is reported as incompatible and the outcome assertions no longer hold. +const SKIPPED_TESTS = new Set([ + 'Post-4.2 InterruptedAtShutdown error', + 'Post-4.2 InterruptedDueToReplStateChange error', + 'Post-4.2 LegacyNotPrimary error', + 'Post-4.2 NotPrimaryNoSecondaryOk error', + 'Post-4.2 NotPrimaryOrSecondary error', + 'Post-4.2 NotWritablePrimary error', + 'Post-4.2 PrimarySteppedDown error', + 'Post-4.2 ShutdownInProgress error' +]); + describe('Server Discovery and Monitoring (spec)', function () { let serverConnect: sinon.SinonStub; @@ -234,7 +248,10 @@ describe('Server Discovery and Monitoring (spec)', function () { }); for (const testData of specTests[specTestName]) { - it(testData.description, async () => { + it(testData.description, async function () { + if (SKIPPED_TESTS.has(testData.description)) { + this.skip(); + } await executeSDAMTest(testData); }); } From 2f0414117dd7bb997e8b2a171262f43da50a7c37 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:03:12 -0400 Subject: [PATCH 15/38] test: skips kerberos & ldap tests pending env var change --- test/manual/kerberos.test.ts | 8 ++++++++ test/manual/ldap.test.ts | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/test/manual/kerberos.test.ts b/test/manual/kerberos.test.ts index 6eafa560a05..1e589cf04ea 100644 --- a/test/manual/kerberos.test.ts +++ b/test/manual/kerberos.test.ts @@ -21,6 +21,14 @@ describe('Kerberos', function () { let lookupStub; let client; + // Skipped while we await migration of the underlying environment variable to point at a + // compatible server. + beforeEach(function () { + this.currentTest.skipReason = + 'Awaiting migration of the underlying env var to aim at a compatible server'; + this.skip(); + }); + beforeEach(() => { lookupStub = sinon.stub(dns, 'lookup').callThrough(); resolveStub = sinon.stub(dns, 'resolve').callThrough(); diff --git a/test/manual/ldap.test.ts b/test/manual/ldap.test.ts index e110b910581..14b16bedc2d 100644 --- a/test/manual/ldap.test.ts +++ b/test/manual/ldap.test.ts @@ -8,6 +8,14 @@ describe('LDAP', function () { const MONGODB_URI = `mongodb://${SASL_USER}:${SASL_PASS}@${SASL_HOST}?authMechanism=plain&authSource=$external`; + // Skipped while we await migration of the underlying environment variable to point at a + // compatible server. + beforeEach(function () { + this.currentTest.skipReason = + 'Awaiting migration of the underlying env var to aim at a compatible server'; + this.skip(); + }); + it('Should correctly authenticate against ldap', async function () { const client = new MongoClient(MONGODB_URI); await client.connect(); From d4241e05650dff5d9e23d53424a7908c8566a3b8 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:09:55 -0400 Subject: [PATCH 16/38] chore: lint --- test/unit/operations/list_collections.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/unit/operations/list_collections.test.js b/test/unit/operations/list_collections.test.js index af0e9901234..e050b7ef581 100644 --- a/test/unit/operations/list_collections.test.js +++ b/test/unit/operations/list_collections.test.js @@ -68,7 +68,6 @@ describe('ListCollectionsOperation', function () { const description = new StreamDescription(); context('when comment is provided', function () { - context('when the wireVersion >= 9', function () { it('sets a comment on the command', function () { const operation = new ListCollectionsOperation( From 000c83bb1344318e0a3defb05647b825428adc10 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 17 Jul 2026 15:11:22 -0400 Subject: [PATCH 17/38] test: skip incompatible tests --- ...rver_discovery_and_monitoring.spec.test.ts | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts b/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts index 25afb24b43b..b8cf8d6c118 100644 --- a/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts +++ b/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts @@ -10,6 +10,7 @@ import { HEARTBEAT_EVENTS, isRecord, LEGACY_HELLO_COMMAND, + MIN_SUPPORTED_WIRE_VERSION, MongoClient, MongoCompatibilityError, MongoError, @@ -191,19 +192,19 @@ function assertMonitoringOutcome(outcome: any): asserts outcome is MonitoringOut expect(outcome).to.have.property('events').that.is.an('array'); } -// These tests assert on Post-4.2 error handling using servers that report wire version 8 -// (MongoDB 4.2), which is below the driver's minimum supported wire version of 9 (MongoDB 4.4). -// As a result the topology is reported as incompatible and the outcome assertions no longer hold. -const SKIPPED_TESTS = new Set([ - 'Post-4.2 InterruptedAtShutdown error', - 'Post-4.2 InterruptedDueToReplStateChange error', - 'Post-4.2 LegacyNotPrimary error', - 'Post-4.2 NotPrimaryNoSecondaryOk error', - 'Post-4.2 NotPrimaryOrSecondary error', - 'Post-4.2 NotWritablePrimary error', - 'Post-4.2 PrimarySteppedDown error', - 'Post-4.2 ShutdownInProgress error' -]); +/** + * Returns true if any hello response in the test reports a server with a + * maxWireVersion below the driver's minimum supported wire version. + */ +function reliesOnIncompatibleServer(testData: SDAMTest): boolean { + return testData.phases.some( + phase => + 'responses' in phase && + (phase.responses || []).some( + ([, { maxWireVersion }]) => maxWireVersion < MIN_SUPPORTED_WIRE_VERSION + ) + ); +} describe('Server Discovery and Monitoring (spec)', function () { let serverConnect: sinon.SinonStub; @@ -249,7 +250,7 @@ describe('Server Discovery and Monitoring (spec)', function () { for (const testData of specTests[specTestName]) { it(testData.description, async function () { - if (SKIPPED_TESTS.has(testData.description)) { + if (reliesOnIncompatibleServer(testData)) { this.skip(); } await executeSDAMTest(testData); From 62465ae15f56426b91ba6202b804e79683229b66 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 17 Jul 2026 15:46:56 -0400 Subject: [PATCH 18/38] Revert "test: skips kerberos & ldap tests pending env var change" This reverts commit d9eedc19dcff5a419835d19af7692aee786c63bb. --- test/manual/kerberos.test.ts | 8 -------- test/manual/ldap.test.ts | 8 -------- 2 files changed, 16 deletions(-) diff --git a/test/manual/kerberos.test.ts b/test/manual/kerberos.test.ts index 1e589cf04ea..6eafa560a05 100644 --- a/test/manual/kerberos.test.ts +++ b/test/manual/kerberos.test.ts @@ -21,14 +21,6 @@ describe('Kerberos', function () { let lookupStub; let client; - // Skipped while we await migration of the underlying environment variable to point at a - // compatible server. - beforeEach(function () { - this.currentTest.skipReason = - 'Awaiting migration of the underlying env var to aim at a compatible server'; - this.skip(); - }); - beforeEach(() => { lookupStub = sinon.stub(dns, 'lookup').callThrough(); resolveStub = sinon.stub(dns, 'resolve').callThrough(); diff --git a/test/manual/ldap.test.ts b/test/manual/ldap.test.ts index 14b16bedc2d..e110b910581 100644 --- a/test/manual/ldap.test.ts +++ b/test/manual/ldap.test.ts @@ -8,14 +8,6 @@ describe('LDAP', function () { const MONGODB_URI = `mongodb://${SASL_USER}:${SASL_PASS}@${SASL_HOST}?authMechanism=plain&authSource=$external`; - // Skipped while we await migration of the underlying environment variable to point at a - // compatible server. - beforeEach(function () { - this.currentTest.skipReason = - 'Awaiting migration of the underlying env var to aim at a compatible server'; - this.skip(); - }); - it('Should correctly authenticate against ldap', async function () { const client = new MongoClient(MONGODB_URI); await client.connect(); From 7a6501947a109abb19524a26e3bb9e0dfd057cb6 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Mon, 20 Jul 2026 12:20:04 -0400 Subject: [PATCH 19/38] fix: update ldap/kerberos test hosts to use a valid server ver --- test/manual/kerberos.test.ts | 4 ++-- test/manual/ldap.test.ts | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/test/manual/kerberos.test.ts b/test/manual/kerberos.test.ts index 6eafa560a05..2c891346a0d 100644 --- a/test/manual/kerberos.test.ts +++ b/test/manual/kerberos.test.ts @@ -36,7 +36,7 @@ describe('Kerberos', function () { }); const krb5Uri = process.env.MONGODB_URI; - const host = process.env.SASL_HOST; + const host = process.env.SASL_HOST_BUILD; if (!process.env.PRINCIPAL) { console.error('skipping Kerberos tests, PRINCIPAL environment variable is not defined'); @@ -222,7 +222,7 @@ describe('Kerberos', function () { it('authenticates', async function () { client = new MongoClient(`${krb5Uri}&maxPoolSize=1`, { authMechanismProperties: { - SERVICE_HOST: 'ldaptest.10gen.cc' + SERVICE_HOST: 'ldaptest.build.10gen.cc' } }); diff --git a/test/manual/ldap.test.ts b/test/manual/ldap.test.ts index e110b910581..3952b2f9218 100644 --- a/test/manual/ldap.test.ts +++ b/test/manual/ldap.test.ts @@ -4,16 +4,21 @@ import * as process from 'process'; import { MongoClient } from '../mongodb'; describe('LDAP', function () { - const { SASL_USER, SASL_PASS, SASL_HOST } = process.env; + const { SASL_USER, SASL_PASS, SASL_HOST_BUILD } = process.env; - const MONGODB_URI = `mongodb://${SASL_USER}:${SASL_PASS}@${SASL_HOST}?authMechanism=plain&authSource=$external`; + const MONGODB_URI = `mongodb://${SASL_USER}:${SASL_PASS}@${SASL_HOST_BUILD}?authMechanism=plain&authSource=$external`; it('Should correctly authenticate against ldap', async function () { const client = new MongoClient(MONGODB_URI); - await client.connect(); - const doc = await client.db('ldap').collection('test').findOne(); - expect(doc).property('ldap').to.equal(true); + let thrown; + try { + await client.connect(); + } catch (error) { + thrown = error; + } + + expect(thrown).to.not.exist; await client.close(); }); From 682d1ddc52e026803f2a9c22299b3a6511a0bfbe Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Mon, 20 Jul 2026 15:41:42 -0400 Subject: [PATCH 20/38] test: fix kerberos test instrument --- .evergreen/run-kerberos-tests.sh | 10 ++++---- test/manual/kerberos.test.ts | 39 +++++++++++++++----------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/.evergreen/run-kerberos-tests.sh b/.evergreen/run-kerberos-tests.sh index ce01e8bf881..c7064c792eb 100644 --- a/.evergreen/run-kerberos-tests.sh +++ b/.evergreen/run-kerberos-tests.sh @@ -14,17 +14,17 @@ echo "Writing keytab" # DON'T PRINT KEYTAB TO STDOUT set +o verbose if [[ "$OSTYPE" == "darwin"* ]]; then - echo ${KEYTAB_BASE64_AES} | base64 -D >"$(pwd)/.evergreen/drivers.keytab" + echo ${KEYTAB_BASE64_BUILD} | base64 -D >"$(pwd)/.evergreen/drivers.keytab" else - echo ${KEYTAB_BASE64_AES} | base64 -d >"$(pwd)/.evergreen/drivers.keytab" + echo ${KEYTAB_BASE64_BUILD} | base64 -d >"$(pwd)/.evergreen/drivers.keytab" fi echo "Running kdestroy" kdestroy -A echo "Running kinit" -kinit -k -t "$(pwd)/.evergreen/drivers.keytab" -p ${PRINCIPAL} +kinit -k -t "$(pwd)/.evergreen/drivers.keytab" -p ${PRINCIPAL_BUILD} -USER=$(node -p "encodeURIComponent(process.env.PRINCIPAL)") -export MONGODB_URI="mongodb://${USER}@${SASL_HOST}/${GSSAPI_DB}?authMechanism=GSSAPI" +USER=$(node -p "encodeURIComponent(process.env.PRINCIPAL_BUILD)") +export MONGODB_URI="mongodb://${USER}@${SASL_HOST_BUILD}/${GSSAPI_DB}?authMechanism=GSSAPI" set -o xtrace diff --git a/test/manual/kerberos.test.ts b/test/manual/kerberos.test.ts index 2c891346a0d..80ab3ce2289 100644 --- a/test/manual/kerberos.test.ts +++ b/test/manual/kerberos.test.ts @@ -12,8 +12,13 @@ const expect = chai.expect; chai.use(require('sinon-chai').default); async function verifyKerberosAuthentication(client) { - const docs = await client.db('kerberos').collection('test').find().toArray(); - expect(docs).to.have.nested.property('[0].kerberos', true); + let thrown; + try { + await client.connect(); + } catch (err) { + thrown = err; + } + expect(thrown).to.not.exist; } describe('Kerberos', function () { @@ -38,14 +43,13 @@ describe('Kerberos', function () { const krb5Uri = process.env.MONGODB_URI; const host = process.env.SASL_HOST_BUILD; - if (!process.env.PRINCIPAL) { - console.error('skipping Kerberos tests, PRINCIPAL environment variable is not defined'); + if (!process.env.PRINCIPAL_BUILD) { + console.error('skipping Kerberos tests, PRINCIPAL_BUILD environment variable is not defined'); return; } it('should authenticate with original uri', async function () { client = new MongoClient(krb5Uri); - await client.connect(); await verifyKerberosAuthentication(client); }); @@ -63,9 +67,9 @@ describe('Kerberos', function () { client = new MongoClient( `${krb5Uri}&authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:forward&maxPoolSize=1` ); - await client.connect(); - expect(resolveStub.withArgs(sinon.match.any, 'CNAME')).to.be.calledOnceWith(host, 'CNAME'); await verifyKerberosAuthentication(client); + expect(resolveStub.withArgs(sinon.match.any, 'CNAME')).to.be.calledOnceWith(host, 'CNAME'); + }); }); @@ -75,12 +79,11 @@ describe('Kerberos', function () { client = new MongoClient( `${krb5Uri}&authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:${option}&maxPoolSize=1` ); - await client.connect(); + await verifyKerberosAuthentication(client); expect(resolveStub.withArgs(sinon.match.any, 'CNAME')).to.not.be.called; // There are 2 calls to establish connection, however they use the callback form of dns.lookup expect(lookupStub).to.not.be.called; - await verifyKerberosAuthentication(client); }); }); } @@ -92,13 +95,12 @@ describe('Kerberos', function () { client = new MongoClient( `${krb5Uri}&authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:${option}&maxPoolSize=1` ); - await client.connect(); + await verifyKerberosAuthentication(client); // There are 2 calls to establish connection, however they use the callback form of dns.lookup // 1 dns.promises.lookup call in canonicalization. expect(lookupStub).to.be.calledOnce; expect(resolveStub.withArgs(sinon.match.any, 'PTR')).to.be.calledOnce; - await verifyKerberosAuthentication(client); }); }); @@ -112,7 +114,7 @@ describe('Kerberos', function () { `${krb5Uri}&authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:${option}&maxPoolSize=1` ); - await client.connect(); + await verifyKerberosAuthentication(client); // There are 2 calls to establish connection, however they use the callback form of dns.lookup // 1 dns.promises.lookup call in canonicalization. expect(lookupStub).to.be.calledOnce; @@ -120,7 +122,6 @@ describe('Kerberos', function () { expect(resolveStub.withArgs(sinon.match.string, 'PTR')).to.be.calledOnce; // Expect the fallback to the host name. expect(resolveStub.withArgs(sinon.match.string, 'CNAME')).to.not.be.called; - await verifyKerberosAuthentication(client); }); }); @@ -134,7 +135,7 @@ describe('Kerberos', function () { `${krb5Uri}&authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:${option}&maxPoolSize=1` ); - await client.connect(); + await verifyKerberosAuthentication(client); // There are 2 calls to establish connection, however they use the callback form of dns.lookup // 1 dns.promises.lookup call in canonicalization. expect(lookupStub).to.be.calledOnce; @@ -142,7 +143,6 @@ describe('Kerberos', function () { expect(resolveStub.withArgs(sinon.match.string, 'PTR')).to.be.calledOnce; // Expect the fallback to be called. expect(resolveStub.withArgs(sinon.match.string, 'CNAME')).to.be.calledOnceWith(host); - await verifyKerberosAuthentication(client); }); }); @@ -155,7 +155,7 @@ describe('Kerberos', function () { client = new MongoClient( `${krb5Uri}&authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:${option}&maxPoolSize=1` ); - await client.connect(); + await verifyKerberosAuthentication(client); // There are 2 calls to establish connection, however they use the callback form of dns.lookup // 1 dns.promises.lookup call in canonicalization. expect(lookupStub).to.be.calledOnce; @@ -163,7 +163,6 @@ describe('Kerberos', function () { expect(resolveStub.withArgs(sinon.match.string, 'PTR')).to.be.calledOnce; // Expect the fallback to be called. expect(resolveStub.withArgs(sinon.match.string, 'CNAME')).to.be.calledOnceWith(host); - await verifyKerberosAuthentication(client); }); }); @@ -176,7 +175,7 @@ describe('Kerberos', function () { client = new MongoClient( `${krb5Uri}&authMechanismProperties=SERVICE_NAME:mongodb,CANONICALIZE_HOST_NAME:${option}&maxPoolSize=1` ); - await client.connect(); + await verifyKerberosAuthentication(client); // There are 2 calls to establish connection, however they use the callback form of dns.lookup // 1 dns.promises.lookup call in canonicalization. expect(lookupStub).to.be.calledOnce; @@ -184,7 +183,6 @@ describe('Kerberos', function () { expect(resolveStub.withArgs(sinon.match.string, 'PTR')).to.be.calledOnce; // Expect the fallback to be called. expect(resolveStub.withArgs(sinon.match.string, 'CNAME')).to.be.calledOnceWith(host); - await verifyKerberosAuthentication(client); }); }); }); @@ -226,7 +224,6 @@ describe('Kerberos', function () { } }); - await client.connect(); await verifyKerberosAuthentication(client); }); }); @@ -260,7 +257,7 @@ describe('Kerberos', function () { it('should fail to authenticate with bad credentials', async function () { client = new MongoClient( - krb5Uri.replace(encodeURIComponent(process.env.PRINCIPAL), 'bad%40creds.cc') + krb5Uri.replace(encodeURIComponent(process.env.PRINCIPAL_BUILD), 'bad%40creds.cc') ); const err = await client.connect().catch(e => e); expect(err.message).to.match(/Authentication failed/); From 3a0a5ddb85e871a13af14c1391d7ef2514b923d9 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:20:31 -0400 Subject: [PATCH 21/38] chore: lint --- test/manual/kerberos.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/test/manual/kerberos.test.ts b/test/manual/kerberos.test.ts index 80ab3ce2289..767a2ddb83d 100644 --- a/test/manual/kerberos.test.ts +++ b/test/manual/kerberos.test.ts @@ -69,7 +69,6 @@ describe('Kerberos', function () { ); await verifyKerberosAuthentication(client); expect(resolveStub.withArgs(sinon.match.any, 'CNAME')).to.be.calledOnceWith(host, 'CNAME'); - }); }); From 2447c1b87d13ad38942475baf89a453daa5a5c03 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:34:13 -0400 Subject: [PATCH 22/38] fix: min supported wire version test --- test/unit/cmap/wire_protocol/constants.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/cmap/wire_protocol/constants.test.ts b/test/unit/cmap/wire_protocol/constants.test.ts index d659788625f..fbcbedfc9fd 100644 --- a/test/unit/cmap/wire_protocol/constants.test.ts +++ b/test/unit/cmap/wire_protocol/constants.test.ts @@ -21,7 +21,7 @@ describe('Wire Protocol Constants', function () { }); describe('MIN_SUPPORTED_WIRE_VERSION', function () { - it('returns 8', function () { + it('returns 9', function () { expect(MIN_SUPPORTED_WIRE_VERSION).to.equal(8); }); }); From cab81e2c962125296f7d0d23ab9631c3722699dd Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Mon, 20 Jul 2026 17:15:33 -0400 Subject: [PATCH 23/38] fix: blunder --- test/unit/cmap/wire_protocol/constants.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/cmap/wire_protocol/constants.test.ts b/test/unit/cmap/wire_protocol/constants.test.ts index fbcbedfc9fd..662497909fc 100644 --- a/test/unit/cmap/wire_protocol/constants.test.ts +++ b/test/unit/cmap/wire_protocol/constants.test.ts @@ -22,7 +22,7 @@ describe('Wire Protocol Constants', function () { describe('MIN_SUPPORTED_WIRE_VERSION', function () { it('returns 9', function () { - expect(MIN_SUPPORTED_WIRE_VERSION).to.equal(8); + expect(MIN_SUPPORTED_WIRE_VERSION).to.equal(9); }); }); From e15f473d49baa192e8f2b3ec19b7378596dbc37c Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Mon, 20 Jul 2026 20:31:41 -0400 Subject: [PATCH 24/38] chore: address copilot comments --- src/error.ts | 2 -- .../connections_survive_step_down.prose.test.ts | 2 +- .../retryable-writes/retryable_writes.spec.prose.test.ts | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/error.ts b/src/error.ts index c401915ba97..72faab592a1 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1394,8 +1394,6 @@ const RETRYABLE_READ_ERROR_CODES = new Set([ const RETRYABLE_WRITE_ERROR_CODES = RETRYABLE_READ_ERROR_CODES; export function needsRetryableWriteLabel(error: Error): boolean { - // pre-4.4 server, then the driver adds an error label for every valid case - // execute operation will only inspect the label, code/message logic is handled here if (error instanceof MongoNetworkError) { return true; } diff --git a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts index b5acd752fb0..05a76f5bef5 100644 --- a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts +++ b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts @@ -91,7 +91,7 @@ describe('Connections Survive Primary Step Down - prose', function () { }); context('Not Primary - Keep Connection Pool', { requires: { topology: ['replicaset'] } }, () => { - // This test requires a replica set with server version 4.4or higher. + // This test requires a replica set with server version 4.4 or higher. // - Set the following fail point: ``{configureFailPoint: "failCommand", mode: {times: 1}, data: {failCommands: ["insert"], errorCode: 10107}}`` const failPoint: FailCommandFailPoint = { diff --git a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts index c4bf0741279..67fcb347c56 100644 --- a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts +++ b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts @@ -85,7 +85,7 @@ describe('Retryable Writes Spec Prose', () => { describe('2. Test that drivers properly retry after encountering PoolClearedErrors.', () => { // This test MUST be implemented by any driver that implements the CMAP specification. - // This test requires MongoDB 4.4.+ for blockConnection support in the failpoint. + // This test requires MongoDB 4.4.0+ for blockConnection support in the failpoint. let client: MongoClient; let failPointName: string | undefined; From f5504899b21c0b0592e0d3a6f63f8f323db851ea Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Thu, 23 Jul 2026 14:12:55 -0400 Subject: [PATCH 25/38] chore: address comment https://github.com/mongodb/node-mongodb-native/pull/4994#discussion_r3639626409 --- src/operations/indexes.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/operations/indexes.ts b/src/operations/indexes.ts index ea4173f66b2..8727eda7168 100644 --- a/src/operations/indexes.ts +++ b/src/operations/indexes.ts @@ -377,16 +377,14 @@ export class ListIndexesOperation extends CommandOperation { return 'listIndexes' as const; } - override buildCommandDocument(connection: Connection): Document { - const serverWireVersion = maxWireVersion(connection); - + override buildCommandDocument(_connection: Connection): Document { const cursor = this.options.batchSize ? { batchSize: this.options.batchSize } : {}; const command: Document = { listIndexes: this.collectionNamespace.collection, cursor }; // we check for undefined specifically here to allow falsy values // eslint-disable-next-line no-restricted-syntax - if (serverWireVersion >= 9 && this.options.comment !== undefined) { + if (this.options.comment !== undefined) { command.comment = this.options.comment; } From bb3247aa8a1e4899de4adc7c7b061979dc018bff Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Thu, 23 Jul 2026 14:14:04 -0400 Subject: [PATCH 26/38] chore: address comment https://github.com/mongodb/node-mongodb-native/pull/4994#discussion_r3639690142 --- src/error.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/error.ts b/src/error.ts index 72faab592a1..e9b8e4c1e03 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1536,8 +1536,8 @@ export function isResumableError(error?: Error, wireVersion?: number): boolean { return true; } - if (wireVersion != null && wireVersion >= 9) { - // DRIVERS-1308: For 4.4 drivers running against 4.4 servers, drivers will add a special case to treat the CursorNotFound error code as resumable + if (wireVersion != null) { + // DRIVERS-1308: For drivers running against >=4.4 servers, drivers will add a special case to treat the CursorNotFound error code as resumable if (error.code === MONGODB_ERROR_CODES.CursorNotFound) { return true; } From 3de146cf63aefe637f97c7c2aee3eac2e5e0698e Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Thu, 23 Jul 2026 14:15:43 -0400 Subject: [PATCH 27/38] chore: address comment https://github.com/mongodb/node-mongodb-native/pull/4994#pullrequestreview-4766138467 --- src/cmap/connection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmap/connection.ts b/src/cmap/connection.ts index f8cc3b2d95e..50f825ff94b 100644 --- a/src/cmap/connection.ts +++ b/src/cmap/connection.ts @@ -287,7 +287,7 @@ export class Connection extends TypedEventEmitter { return ( this.description != null && // TODO(NODE-6672,NODE-6287): This guard is primarily for maxWireVersion = 0 - maxWireVersion(this) >= 6 && + maxWireVersion(this) > 0 && !this.description.__nodejs_mock_server__ ); } From 44812d80d241447f363681c6b66520f67a326392 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Thu, 23 Jul 2026 14:44:45 -0400 Subject: [PATCH 28/38] test: fix tests --- src/operations/indexes.ts | 2 +- test/unit/error.test.ts | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/operations/indexes.ts b/src/operations/indexes.ts index 8727eda7168..787bc3b7da1 100644 --- a/src/operations/indexes.ts +++ b/src/operations/indexes.ts @@ -4,7 +4,7 @@ import { CursorResponse, MongoDBResponse } from '../cmap/wire_protocol/responses import type { Collection } from '../collection'; import { type AbstractCursorOptions } from '../cursor/abstract_cursor'; import { type OneOrMore } from '../mongo_types'; -import { isObject, maxWireVersion, type MongoDBNamespace } from '../utils'; +import { isObject, type MongoDBNamespace } from '../utils'; import { type CollationOptions, CommandOperation, diff --git a/test/unit/error.test.ts b/test/unit/error.test.ts index 3dab63fd02a..ca93dfa0e24 100644 --- a/test/unit/error.test.ts +++ b/test/unit/error.test.ts @@ -572,11 +572,10 @@ describe('MongoErrors', () => { expect(isResumableError(mongoError, 8)).to.be.true; }); - it('for resumable codes if wireVersion is below 9 or unspecified', () => { + it('for resumable codes if wireVersion is unspecified', () => { const mongoError = new MongoError('ah!'); mongoError.code = MONGODB_ERROR_CODES.ShutdownInProgress; // Shutdown in progress is resumable expect(isResumableError(mongoError)).to.be.true; - expect(isResumableError(mongoError, 8)).to.be.true; }); it('for labeled MongoError only if the wireVersion is at least 9', () => { @@ -643,14 +642,6 @@ describe('MongoErrors', () => { expect(isResumableError(mongoError, 8)).to.be.false; expect(isResumableError(mongoError, 9)).to.be.false; }); - - it('for labeled error below wire version 9', () => { - const mongoError = new MongoError('ah!'); - mongoError.addErrorLabel(MongoErrorLabel.ResumableChangeStreamError); - expect(mongoError.hasErrorLabel(MongoErrorLabel.ResumableChangeStreamError)).to.be.true; - expect(isResumableError(mongoError, 8)).to.be.false; - expect(isResumableError(mongoError)).to.be.false; - }); }); }); From 69bbfa7f430771325cf79fbd79db696c26289384 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 24 Jul 2026 12:55:23 -0400 Subject: [PATCH 29/38] docs: address comment https://github.com/mongodb/node-mongodb-native/pull/4994#issuecomment-5071959234 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00a05829f89..4ddd9795d5a 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Change history can be found in [`HISTORY.md`](https://github.com/mongodb/node-mo ### Compatibility -The driver currently supports 4.2+ servers. +The driver currently supports 4.4+ servers. For exhaustive server and runtime version compatibility matrices, please refer to the following links: From a6bf8446e4ae7dcfcf9c89301abda686e8f14b71 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 24 Jul 2026 13:09:08 -0400 Subject: [PATCH 30/38] docs: cleanup redundant callouts to minserver v --- src/bulk/common.ts | 2 +- src/cmap/command_monitoring_events.ts | 6 +++--- .../client_side_operations_timeout.prose.test.ts | 2 +- .../connections_survive_step_down.prose.test.ts | 4 ++-- .../retryable-reads/retryable_reads.spec.prose.test.ts | 1 - .../retryable-writes/retryable_writes.spec.prose.test.ts | 1 - .../server_discovery_and_monitoring.prose.test.ts | 1 - .../server_selection.prose.operation_count.test.ts | 2 +- test/integration/sessions/sessions.prose.test.ts | 1 - 9 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/bulk/common.ts b/src/bulk/common.ts index 1927109c957..0f3f7cbffe1 100644 --- a/src/bulk/common.ts +++ b/src/bulk/common.ts @@ -1011,7 +1011,7 @@ export abstract class BulkOperationBase { * // Add a replaceOne * bulkOp.find({ i: 9 }).replaceOne({writeConcern: { j: 10 }}); * - * // Update using a pipeline (requires Mongodb 4.4 or higher) + * // Update using a pipeline * bulk.find({ k: 11, y: { $exists: true }, z: { $exists: true } }).updateOne([ * { $set: { total: { $sum: [ '$y', '$z' ] } } } * ]); diff --git a/src/cmap/command_monitoring_events.ts b/src/cmap/command_monitoring_events.ts index 2b16e897bb9..801295ec347 100644 --- a/src/cmap/command_monitoring_events.ts +++ b/src/cmap/command_monitoring_events.ts @@ -32,7 +32,7 @@ export class CommandStartedEvent { /** * Server generated connection id * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" - * from the server on 4.4+. + * from the server. */ serverConnectionId: bigint | null; serviceId?: ObjectId; @@ -88,7 +88,7 @@ export class CommandSucceededEvent { connectionId?: string | number; /** * Server generated connection id - * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" from the server on 4.4+. + * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" from the server. */ serverConnectionId: bigint | null; requestId: number; @@ -148,7 +148,7 @@ export class CommandFailedEvent { connectionId?: string | number; /** * Server generated connection id - * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" from the server on 4.4+. + * Distinct from the connection id and is returned by the hello or legacy hello response as "connectionId" from the server. */ serverConnectionId: bigint | null; requestId: number; diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts index 803d8305172..436ad0e73d9 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts @@ -122,7 +122,7 @@ describe('CSOT spec prose tests', function () { context('2. maxTimeMS is not set for commands sent to mongocryptd', () => { /** - * This test MUST only be run against enterprise server versions 4.4 and higher. + * This test MUST only be run against enterprise servers. * * 1. Launch a mongocryptd process on 23000. * 1. Create a MongoClient (referred to as `client`) using the URI `mongodb://localhost:23000/?timeoutMS=1000`. diff --git a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts index 05a76f5bef5..8bf05d073cf 100644 --- a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts +++ b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts @@ -44,7 +44,7 @@ describe('Connections Survive Primary Step Down - prose', function () { }); context('getMore Iteration', { requires: { topology: ['replicaset'] } }, () => { - // This test requires a replica set with server version 4.4 or higher. + // This test requires a replica set. let cursor: FindCursor; afterEach(() => cursor.close()); @@ -91,7 +91,7 @@ describe('Connections Survive Primary Step Down - prose', function () { }); context('Not Primary - Keep Connection Pool', { requires: { topology: ['replicaset'] } }, () => { - // This test requires a replica set with server version 4.4 or higher. + // This test requires a replica set. // - Set the following fail point: ``{configureFailPoint: "failCommand", mode: {times: 1}, data: {failCommands: ["insert"], errorCode: 10107}}`` const failPoint: FailCommandFailPoint = { diff --git a/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts b/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts index 4346f719e75..fc1c17e2677 100644 --- a/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts +++ b/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts @@ -30,7 +30,6 @@ describe('Retryable Reads Spec Prose', () => { describe('PoolClearedError Retryability Test', () => { // This test will be used to ensure drivers properly retry after encountering PoolClearedErrors. // It MUST be implemented by any driver that implements the CMAP specification. - // This test requires MongoDB 4.4.0+ for blockConnection support in the failpoint. let cmapEvents: Array<{ name: string; event: Record }>; let commandStartedEvents: Array>; diff --git a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts index 67fcb347c56..32082873a2f 100644 --- a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts +++ b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts @@ -85,7 +85,6 @@ describe('Retryable Writes Spec Prose', () => { describe('2. Test that drivers properly retry after encountering PoolClearedErrors.', () => { // This test MUST be implemented by any driver that implements the CMAP specification. - // This test requires MongoDB 4.4.0+ for blockConnection support in the failpoint. let client: MongoClient; let failPointName: string | undefined; diff --git a/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts b/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts index 508e2741a7e..4189a68a4c9 100644 --- a/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts +++ b/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts @@ -94,7 +94,6 @@ describe('Server Discovery and Monitoring Prose Tests', function () { context('Connection Pool Management', function () { /* This test will be used to ensure monitors properly create and unpause connection pools when they discover servers. - This test requires failCommand appName support which is only available in MongoDB 4.4.0+. 1. Create a client with directConnection=true, appName="SDAMPoolManagementTest", and heartbeatFrequencyMS=500 (or lower if possible). 2. Verify via SDAM and CMAP event monitoring that a ConnectionPoolReadyEvent occurs after the first ServerHeartbeatSucceededEvent event does. 3. Enable the following failpoint: diff --git a/test/integration/server-selection/server_selection.prose.operation_count.test.ts b/test/integration/server-selection/server_selection.prose.operation_count.test.ts index f34f485a38a..ca3a42f4274 100644 --- a/test/integration/server-selection/server_selection.prose.operation_count.test.ts +++ b/test/integration/server-selection/server_selection.prose.operation_count.test.ts @@ -27,7 +27,7 @@ async function runTaskGroup(collection: Collection, count: 10 | 100 | 1000) { } } -// Step 1: Configure a sharded cluster with two mongoses. Use a 4.4.0 or newer server version. +// Step 1: Configure a sharded cluster with two mongoses. const TEST_METADATA: MongoDBMetadataUI = { requires: { mongodb: '>=4.4.0', topology: 'sharded' } }; describe('operationCount-based Selection Within Latency Window - Prose Test', function () { diff --git a/test/integration/sessions/sessions.prose.test.ts b/test/integration/sessions/sessions.prose.test.ts index b1c67810d68..ed971612afa 100644 --- a/test/integration/sessions/sessions.prose.test.ts +++ b/test/integration/sessions/sessions.prose.test.ts @@ -129,7 +129,6 @@ describe('Sessions Prose Tests', () => { /** * Since all regular 3.6+ servers support sessions, the prose tests which test for * session non-support SHOULD use a mongocryptd server as the test server - * (available with server versions 4.4+) * * As part of the test setup for these cases, create a MongoClient pointed at the test server * with the options specified in the test case and verify that the test server does NOT define a From 792bb97cac6769e307e1b17491629423ddd63c25 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 24 Jul 2026 13:22:41 -0400 Subject: [PATCH 31/38] docs: cleanup more redundant references --- src/cursor/abstract_cursor.ts | 5 ---- src/error.ts | 4 +-- src/gridfs/download.ts | 2 +- src/operations/command.ts | 5 ---- src/operations/find_and_modify.ts | 5 ---- src/operations/get_more.ts | 2 -- src/operations/indexes.ts | 4 +-- src/operations/validate_collection.ts | 2 +- .../integration/enumerate_collections.test.ts | 26 ---------------- test/integration/enumerate_databases.test.ts | 26 ---------------- test/integration/enumerate_indexes.test.ts | 26 ---------------- test/integration/index_management.test.ts | 30 ------------------- 12 files changed, 6 insertions(+), 131 deletions(-) diff --git a/src/cursor/abstract_cursor.ts b/src/cursor/abstract_cursor.ts index 693e1204d81..f5f0b14d99f 100644 --- a/src/cursor/abstract_cursor.ts +++ b/src/cursor/abstract_cursor.ts @@ -126,11 +126,6 @@ export interface AbstractCursorOptions extends BSONSerializeOptions { maxAwaitTimeMS?: number; /** * Comment to apply to the operation. - * - * In server versions pre-4.4, 'comment' must be string. A server - * error will be thrown if any other type is provided. - * - * In server versions 4.4 and above, 'comment' can be any valid BSON type. */ comment?: unknown; /** diff --git a/src/error.ts b/src/error.ts index e9b8e4c1e03..f9512353ee0 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1399,7 +1399,7 @@ export function needsRetryableWriteLabel(error: Error): boolean { } if (error instanceof MongoError) { if (!error.hasErrorLabel(MongoErrorLabel.HandshakeError)) { - // If we already have the error label no need to add it again. 4.4+ servers add the label. + // If we already have the error label no need to add it again. servers add the label. // In the case where we have a handshake error, need to fall down to the logic checking // the codes. return false; @@ -1537,7 +1537,7 @@ export function isResumableError(error?: Error, wireVersion?: number): boolean { } if (wireVersion != null) { - // DRIVERS-1308: For drivers running against >=4.4 servers, drivers will add a special case to treat the CursorNotFound error code as resumable + // DRIVERS-1308: Drivers will add a special case to treat the CursorNotFound error code as resumable if (error.code === MONGODB_ERROR_CODES.CursorNotFound) { return true; } diff --git a/src/gridfs/download.ts b/src/gridfs/download.ts index fb6691cb8cd..b391aa1c209 100644 --- a/src/gridfs/download.ts +++ b/src/gridfs/download.ts @@ -351,7 +351,7 @@ function init(stream: GridFSBucketReadStream): void { const filter: Document = { files_id: doc._id }; - // Currently (MongoDB 3.4.4) skip function does not support the index, + // Currently the skip function does not support the index, // it needs to retrieve all the documents first and then skip them. (CS-25811) // As work around we use $gte on the "n" field. if (stream.s.options && stream.s.options.start != null) { diff --git a/src/operations/command.ts b/src/operations/command.ts index da499fa685b..ebaba8607ea 100644 --- a/src/operations/command.ts +++ b/src/operations/command.ts @@ -46,11 +46,6 @@ export interface CommandOperationOptions maxTimeMS?: number; /** * Comment to apply to the operation. - * - * In server versions pre-4.4, 'comment' must be string. A server - * error will be thrown if any other type is provided. - * - * In server versions 4.4 and above, 'comment' can be any valid BSON type. */ comment?: unknown; // Admin command overrides. diff --git a/src/operations/find_and_modify.ts b/src/operations/find_and_modify.ts index 32f16584ed6..8ed9a6a0514 100644 --- a/src/operations/find_and_modify.ts +++ b/src/operations/find_and_modify.ts @@ -97,11 +97,6 @@ interface FindAndModifyCmdBase { writeConcern?: WriteConcern | WriteConcernSettings; /** * Comment to apply to the operation. - * - * In server versions pre-4.4, 'comment' must be string. A server - * error will be thrown if any other type is provided. - * - * In server versions 4.4 and above, 'comment' can be any valid BSON type. */ comment?: unknown; } diff --git a/src/operations/get_more.ts b/src/operations/get_more.ts index bdfcb458c62..064a1cb0e5f 100644 --- a/src/operations/get_more.ts +++ b/src/operations/get_more.ts @@ -13,8 +13,6 @@ export interface GetMoreOptions extends OperationOptions { batchSize?: number; /** * Comment to apply to the operation. - * - * getMore only supports 'comment' in server versions 4.4 and above. */ comment?: unknown; /** Number of milliseconds to wait before aborting the query. */ diff --git a/src/operations/indexes.ts b/src/operations/indexes.ts index 787bc3b7da1..d6ae371f702 100644 --- a/src/operations/indexes.ts +++ b/src/operations/indexes.ts @@ -137,7 +137,7 @@ export interface CreateIndexesOptions extends Omit { - /** Validates a collection in the background, without interrupting read or write traffic (only in MongoDB 4.4+) */ + /** Validates a collection in the background, without interrupting read or write traffic */ background?: boolean; } diff --git a/test/integration/enumerate_collections.test.ts b/test/integration/enumerate_collections.test.ts index 85c043c29fb..161fac6a3b1 100644 --- a/test/integration/enumerate_collections.test.ts +++ b/test/integration/enumerate_collections.test.ts @@ -8,32 +8,6 @@ describe('listCollections', () => { databaseName: 'database0', documents: [{ _id: 1, x: 11 }] }) - .test( - new TestBuilder('listCollections should not send comment for server versions < 4.4') - .runOnRequirement({ maxServerVersion: '4.3.99' }) - .operation({ - name: 'listCollections', - arguments: { - filter: {}, - comment: 'string value' - }, - object: 'database0' - }) - .expectEvents({ - client: 'client0', - events: [ - { - commandStartedEvent: { - command: { - listCollections: 1, - comment: { $$exists: false } - } - } - } - ] - }) - .toJSON() - ) .test( new TestBuilder('listCollections should send string comment for server versions >= 4.4') .runOnRequirement({ minServerVersion: '4.4.0' }) diff --git a/test/integration/enumerate_databases.test.ts b/test/integration/enumerate_databases.test.ts index 0b52ade1303..f1967b67a96 100644 --- a/test/integration/enumerate_databases.test.ts +++ b/test/integration/enumerate_databases.test.ts @@ -192,32 +192,6 @@ describe('listDatabases()', function () { databaseName: 'database0', documents: [{ _id: 1, x: 11 }] }) - .test( - new TestBuilder('listDatabases should not send comment for server versions < 4.4') - .runOnRequirement({ maxServerVersion: '4.3.99' }) - .operation({ - name: 'listDatabases', - arguments: { - filter: {}, - comment: 'string value' - }, - object: 'client0' - }) - .expectEvents({ - client: 'client0', - events: [ - { - commandStartedEvent: { - command: { - listDatabases: 1, - comment: { $$exists: false } - } - } - } - ] - }) - .toJSON() - ) .test( new TestBuilder('listDatabases should send string comment for server versions >= 4.4') .runOnRequirement({ minServerVersion: '4.4.0' }) diff --git a/test/integration/enumerate_indexes.test.ts b/test/integration/enumerate_indexes.test.ts index 8e8793d6040..d2a5114e6d8 100644 --- a/test/integration/enumerate_indexes.test.ts +++ b/test/integration/enumerate_indexes.test.ts @@ -8,32 +8,6 @@ describe('listIndexes()', () => { databaseName: 'database0', documents: [{ _id: 1, x: 11 }] }) - .test( - new TestBuilder('listIndexes should not send comment for server versions < 4.4') - .runOnRequirement({ maxServerVersion: '4.3.99' }) - .operation({ - name: 'listIndexes', - arguments: { - filter: {}, - comment: 'string value' - }, - object: 'collection0' - }) - .expectEvents({ - client: 'client0', - events: [ - { - commandStartedEvent: { - command: { - listIndexes: 'collection0', - comment: { $$exists: false } - } - } - } - ] - }) - .toJSON() - ) .test( new TestBuilder('listIndexes should send string comment for server versions >= 4.4') .runOnRequirement({ minServerVersion: '4.4.0' }) diff --git a/test/integration/index_management.test.ts b/test/integration/index_management.test.ts index 100cb1c9a5a..abbb5e8899c 100644 --- a/test/integration/index_management.test.ts +++ b/test/integration/index_management.test.ts @@ -728,36 +728,6 @@ describe('Indexes', function () { await client.close(); }); - function throwErrorTest(testCommand: (db: Db, collection: Collection) => Promise) { - return { - metadata: { requires: { mongodb: '<4.4' } }, - test: async function () { - const db = client.db('test'); - const collection = db.collection('commitQuorum'); - const err = await testCommand(db, collection).catch(e => e); - expect(err.message).to.equal( - 'Option `commitQuorum` for `createIndexes` not supported on servers < 4.4' - ); - } - }; - } - it( - 'should throw an error if commitQuorum specified on db.createIndex', - throwErrorTest((db, collection) => - db.createIndex(collection.collectionName, 'a', { commitQuorum: 'all' }) - ) - ); - it( - 'should throw an error if commitQuorum specified on collection.createIndex', - throwErrorTest((db, collection) => collection.createIndex('a', { commitQuorum: 'all' })) - ); - it( - 'should throw an error if commitQuorum specified on collection.createIndexes', - throwErrorTest((db, collection) => - collection.createIndexes([{ key: { a: 1 } }, { key: { b: 1 } }], { commitQuorum: 'all' }) - ) - ); - function commitQuorumTest( testCommand: (db: Db, collection: Collection) => Promise ): any { From 9cb464e931cedc7ddb5ef67277197bd274794e4e Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 24 Jul 2026 13:26:04 -0400 Subject: [PATCH 32/38] docs: remove more redundant references --- test/spec/client-side-operations-timeout/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/client-side-operations-timeout/README.md b/test/spec/client-side-operations-timeout/README.md index a960c2de219..c555187a4f1 100644 --- a/test/spec/client-side-operations-timeout/README.md +++ b/test/spec/client-side-operations-timeout/README.md @@ -58,7 +58,7 @@ for differing bulk encoding performance. ### 2. maxTimeMS is not set for commands sent to mongocryptd -This test MUST only be run against enterprise server versions 4.2 and higher. +This test MUST only be run against enterprise servers. 1. Launch a mongocryptd process on 23000. 2. Create a MongoClient (referred to as `client`) using the URI `mongodb://localhost:23000/?timeoutMS=1000`. From 3aa9e05b9fb26f7bff7c5ee9fcb8cff67ec561cf Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Fri, 24 Jul 2026 13:33:01 -0400 Subject: [PATCH 33/38] chore: remove more redundant tests --- .../command_monitoring.test.ts | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/test/integration/command-logging-and-monitoring/command_monitoring.test.ts b/test/integration/command-logging-and-monitoring/command_monitoring.test.ts index 9242770d46c..3ea3320b0a8 100644 --- a/test/integration/command-logging-and-monitoring/command_monitoring.test.ts +++ b/test/integration/command-logging-and-monitoring/command_monitoring.test.ts @@ -472,46 +472,6 @@ describe('Command Monitoring', function () { } }); - it('should ensure killcursor commands are sent on 3.0 or earlier when APM is enabled', { - metadata: { requires: { topology: ['single', 'replicaset'], mongodb: '<=3.0.x' } }, - - test: function () { - const client = this.configuration.newClient( - { writeConcern: { w: 1 } }, - { maxPoolSize: 1, monitorCommands: true } - ); - - const db = client.db(this.configuration.db); - const admindb = db.admin(); - let cursorCountBefore; - let cursorCountAfter; - - const collection = db.collection('apm_killcursor_tests'); - - // make sure collection has records (more than 2) - return collection - .insertMany([{ a: 1 }, { a: 2 }, { a: 3 }]) - .then(r => { - expect(r).to.exist; - return admindb.serverStatus(); - }) - .then(result => { - cursorCountBefore = result.cursors.clientCursors_size; - const cursor = collection.find({}).limit(2); - return cursor.toArray().then(r => { - expect(r).to.exist; - return cursor.close(); - }); - }) - .then(() => admindb.serverStatus()) - .then(result => { - cursorCountAfter = result.cursors.clientCursors_size; - expect(cursorCountBefore).to.equal(cursorCountAfter); - return client.close(); - }); - } - }); - it('should correctly decorate the apm result for aggregation with cursorId', async function () { const started = []; const succeeded = []; From e1aa9fee929de0d110bdc944fc28bf26207e2d02 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 28 Jul 2026 09:50:47 -0400 Subject: [PATCH 34/38] fix: address comment https://github.com/mongodb/node-mongodb-native/pull/4994#discussion_r3660992585 --- src/cmap/connection.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cmap/connection.ts b/src/cmap/connection.ts index 50f825ff94b..7823e3124fd 100644 --- a/src/cmap/connection.ts +++ b/src/cmap/connection.ts @@ -286,8 +286,10 @@ export class Connection extends TypedEventEmitter { private get supportsOpMsg(): boolean { return ( this.description != null && - // TODO(NODE-6672,NODE-6287): This guard is primarily for maxWireVersion = 0 - maxWireVersion(this) > 0 && + // OP_MSG was introduced in server 3.6 (wire version 6). This also guards + // against the pre-handshake case where maxWireVersion() returns 0. + // TODO(NODE-6672,NODE-6287): remove this helper once OP_QUERY support is dropped + maxWireVersion(this) >= 6 && !this.description.__nodejs_mock_server__ ); } From 412b4b4f468af29c7bef6c2be2738e27d13c2429 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 28 Jul 2026 14:57:52 -0400 Subject: [PATCH 35/38] fix: address comment https://github.com/mongodb/node-mongodb-native/pull/4994#discussion_r3661015440 --- src/error.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/error.ts b/src/error.ts index f9512353ee0..3de8a18db5a 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1536,7 +1536,7 @@ export function isResumableError(error?: Error, wireVersion?: number): boolean { return true; } - if (wireVersion != null) { + if (wireVersion != null && wireVersion >= 9) { // DRIVERS-1308: Drivers will add a special case to treat the CursorNotFound error code as resumable if (error.code === MONGODB_ERROR_CODES.CursorNotFound) { return true; From 0287af67b84017ec993ccb7aad636d4370f98b27 Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:07:30 -0400 Subject: [PATCH 36/38] docs: add comment to isResumableerror --- src/error.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/error.ts b/src/error.ts index 3de8a18db5a..37979e87a83 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1536,6 +1536,9 @@ export function isResumableError(error?: Error, wireVersion?: number): boolean { return true; } + // wireVersion of 0 is possible when the server version is unknown (e.g heartbeat failure), so despite + // all supported servers being wire version 9+, the >= 9 bound must stay to route "unknown" to the + // code-list fallback below to maintain parity. if (wireVersion != null && wireVersion >= 9) { // DRIVERS-1308: Drivers will add a special case to treat the CursorNotFound error code as resumable if (error.code === MONGODB_ERROR_CODES.CursorNotFound) { From eedf1e90161b7f75cd3a76f7c62913769e2a57bf Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:17:22 -0400 Subject: [PATCH 37/38] docs: address comment https://github.com/mongodb/node-mongodb-native/pull/4994#discussion_r3660304956 --- src/cmap/auth/mongo_credentials.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cmap/auth/mongo_credentials.ts b/src/cmap/auth/mongo_credentials.ts index f8d7e33c95c..6889414e496 100644 --- a/src/cmap/auth/mongo_credentials.ts +++ b/src/cmap/auth/mongo_credentials.ts @@ -25,7 +25,6 @@ function getDefaultAuthMechanism(hello: Document | null): AuthMechanism { } } - // Default auth mechanism for 4.0 and higher. return AuthMechanism.MONGODB_SCRAM_SHA256; } From a986a429215f61e6aef667781fdd2a8cec71532d Mon Sep 17 00:00:00 2001 From: Johnathan Martell <286711055+johnmtll@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:18:51 -0400 Subject: [PATCH 38/38] docs: address comment https://github.com/mongodb/node-mongodb-native/pull/4994#discussion_r3660281694 --- src/operations/list_collections.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/operations/list_collections.ts b/src/operations/list_collections.ts index b829af4e9b0..ff1bc6a9f09 100644 --- a/src/operations/list_collections.ts +++ b/src/operations/list_collections.ts @@ -11,11 +11,11 @@ import { Aspect, defineAspects } from './operation'; export interface ListCollectionsOptions extends Omit, Abortable { - /** Since 4.0: If true, will only return the collection name in the response, and will omit additional info */ + /** If true, will only return the collection name in the response, and will omit additional info */ nameOnly?: boolean; - /** Since 4.0: If true and nameOnly is true, allows a user without the required privilege (i.e. listCollections action on the database) to run the command when access control is enforced. */ + /** If true and nameOnly is true, allows a user without the required privilege (i.e. listCollections action on the database) to run the command when access control is enforced. */ authorizedCollections?: boolean; - /** The batchSize for the returned command cursor or if pre 2.8 the systems batch collection */ + /** The batchSize for the returned command cursor */ batchSize?: number; /** @internal */ timeoutMode?: CursorTimeoutMode;