Skip to content

DRIVERS-3439 Remove pre-MongoDB 4.2 references from specs and tests#1929

Open
jyemin wants to merge 2 commits into
mongodb:masterfrom
jyemin:DRIVERS-3439
Open

DRIVERS-3439 Remove pre-MongoDB 4.2 references from specs and tests#1929
jyemin wants to merge 2 commits into
mongodb:masterfrom
jyemin:DRIVERS-3439

Conversation

@jyemin

@jyemin jyemin commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes all spec tests and prose gated on MongoDB server versions < 4.2, now that 4.2 is the minimum supported server version.

  • 26 YAML spec test files deleted (CRUD client/server error tests, CLM pre-42 connection ID tests, CSE maxWireVersion tests, SDAM pre-42 error tests + template)
  • 28 individual tests removed from mixed files (dots_and_dollars pre-3.6 tests, hint-unacknowledged pre-4.2 tests, dead copydb* tests in redacted-commands)
  • 18 spec documents simplified — removed version-conditional language for SDAM, collation, auth, transactions, retryable-writes, read-write-concern, find_getmore, OP_MSG, change-streams, unified-test-format, index-management, compression, enumerate-collections, enumerate-databases, causal-consistency, handshake, decimal128
  • generate-error-tests.py cleaned up: removed create_pre_42_tests() function

JSON files for modified YAML tests were regenerated via make and committed separately. Commits will be squashed before merge.

DRIVERS-3439

@GromNaN

GromNaN commented May 13, 2026

Copy link
Copy Markdown
Member

Should you drop everything specific to maxWireVersion < 9? They are not relevant for server >= 4.4

@jyemin jyemin requested a review from NoahStapp June 9, 2026 15:14
@jyemin

jyemin commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Should you drop everything specific to maxWireVersion < 9? They are not relevant for server >= 4.4

I don't want to remove 4.2 references until all drivers remove support for 4.2. Definitely a good followup though, once that happens.

@jyemin jyemin requested a review from GromNaN June 9, 2026 15:18
@jyemin jyemin marked this pull request as ready for review June 9, 2026 15:18
@jyemin jyemin requested review from a team as code owners June 9, 2026 15:18
@jyemin jyemin requested review from Copilot and mana2-bot June 9, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the MongoDB driver specifications and associated unified/legacy test suites to reflect MongoDB 4.2 as the minimum supported server version, removing pre-4.2 (and some earlier) conditional prose and test coverage.

Changes:

  • Removed pre-4.2-gated YAML/JSON spec tests (notably SDAM error templates/tests, CLM connection-id tests, CSFLE maxWireVersion tests, and various CRUD “client/server error on older server” cases).
  • Simplified multiple spec documents by deleting version-conditional language that is no longer relevant with a 4.2+ baseline.
  • Updated SDAM error test generator to stop producing pre-4.2 test variants.

Reviewed changes

Copilot reviewed 95 out of 95 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
source/unified-test-format/unified-test-format.md Simplifies deprecated topology guidance by removing version gating.
source/transactions/transactions.md Removes pre-4.2-era constraints; updates transaction eligibility text and other prose.
source/server-discovery-and-monitoring/tests/errors/pre-42.yml.template Deletes pre-4.2 SDAM error test template.
source/server-discovery-and-monitoring/tests/errors/pre-42-ShutdownInProgress.yml Deletes pre-4.2 SDAM error test.
source/server-discovery-and-monitoring/tests/errors/pre-42-ShutdownInProgress.json Deletes generated JSON for the removed pre-4.2 SDAM test.
source/server-discovery-and-monitoring/tests/errors/pre-42-PrimarySteppedDown.yml Deletes pre-4.2 SDAM error test.
source/server-discovery-and-monitoring/tests/errors/pre-42-PrimarySteppedDown.json Deletes generated JSON for the removed pre-4.2 SDAM test.
source/server-discovery-and-monitoring/tests/errors/pre-42-NotWritablePrimary.yml Deletes pre-4.2 SDAM error test.
source/server-discovery-and-monitoring/tests/errors/pre-42-NotWritablePrimary.json Deletes generated JSON for the removed pre-4.2 SDAM test.
source/server-discovery-and-monitoring/tests/errors/pre-42-NotPrimaryOrSecondary.yml Deletes pre-4.2 SDAM error test.
source/server-discovery-and-monitoring/tests/errors/pre-42-NotPrimaryOrSecondary.json Deletes generated JSON for the removed pre-4.2 SDAM test.
source/server-discovery-and-monitoring/tests/errors/pre-42-NotPrimaryNoSecondaryOk.yml Deletes pre-4.2 SDAM error test.
source/server-discovery-and-monitoring/tests/errors/pre-42-NotPrimaryNoSecondaryOk.json Deletes generated JSON for the removed pre-4.2 SDAM test.
source/server-discovery-and-monitoring/tests/errors/pre-42-LegacyNotPrimary.yml Deletes pre-4.2 SDAM error test.
source/server-discovery-and-monitoring/tests/errors/pre-42-LegacyNotPrimary.json Deletes generated JSON for the removed pre-4.2 SDAM test.
source/server-discovery-and-monitoring/tests/errors/pre-42-InterruptedDueToReplStateChange.yml Deletes pre-4.2 SDAM error test.
source/server-discovery-and-monitoring/tests/errors/pre-42-InterruptedDueToReplStateChange.json Deletes generated JSON for the removed pre-4.2 SDAM test.
source/server-discovery-and-monitoring/tests/errors/pre-42-InterruptedAtShutdown.yml Deletes pre-4.2 SDAM error test.
source/server-discovery-and-monitoring/tests/errors/pre-42-InterruptedAtShutdown.json Deletes generated JSON for the removed pre-4.2 SDAM test.
source/server-discovery-and-monitoring/tests/errors/generate-error-tests.py Removes pre-4.2 test generation path.
source/server-discovery-and-monitoring/server-discovery-and-monitoring.md Removes pre-4.2 pool-clearing behavior language.
source/server-discovery-and-monitoring/server-discovery-and-monitoring-summary.md Aligns SDAM summary with 4.2+ behavior (no pool clear).
source/retryable-writes/retryable-writes.md Removes older-version gating and simplifies unsupported-operation prose.
source/read-write-concern/read-write-concern.md Removes aggregate-with-write-stage readConcern pre-4.2 carveout.
source/mongodb-handshake/handshake.md Removes 3.4-specific wording to reflect current baseline.
source/index-management/index-management.md Removes “new in MongoDB X.Y” phrasing for index option docs.
source/find_getmore_killcursors_commands/find_getmore_killcursors_commands.md Drops pre-4.2 exhaust behavior rows from tables.
source/enumerate-databases/enumerate-databases.md Removes historical version introduction notes for listDatabases options.
source/enumerate-collections/enumerate-collections.md Removes historical version introduction notes for listCollections options.
source/crud/tests/unified/updateOne-hint-unacknowledged.yml Removes pre-4.2 test cases; reanchors shared filter/update values.
source/crud/tests/unified/updateOne-hint-unacknowledged.json Regenerated JSON reflecting removal of pre-4.2 cases.
source/crud/tests/unified/updateOne-hint-serverError.yml Deletes pre-4.2-only unified test.
source/crud/tests/unified/updateOne-hint-serverError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/updateOne-hint-clientError.yml Deletes pre-4.2-only unified test.
source/crud/tests/unified/updateOne-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/updateMany-hint-unacknowledged.yml Removes pre-4.2 test cases; reanchors shared filter/update values.
source/crud/tests/unified/updateMany-hint-unacknowledged.json Regenerated JSON reflecting removal of pre-4.2 cases.
source/crud/tests/unified/updateMany-hint-serverError.yml Deletes pre-4.2-only unified test.
source/crud/tests/unified/updateMany-hint-serverError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/updateMany-hint-clientError.yml Deletes pre-4.2-only unified test.
source/crud/tests/unified/updateMany-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/replaceOne-hint-unacknowledged.yml Removes pre-4.2 test cases; reanchors shared filter/replacement values.
source/crud/tests/unified/replaceOne-hint-unacknowledged.json Regenerated JSON reflecting removal of pre-4.2 cases.
source/crud/tests/unified/replaceOne-dots_and_dollars.yml Removes pre-3.6 cases from dots-and-dollars replaceOne tests.
source/crud/tests/unified/replaceOne-dots_and_dollars.json Regenerated JSON reflecting removal of pre-3.6 cases.
source/crud/tests/unified/insertOne-dots_and_dollars.yml Removes pre-3.6 case from dots-and-dollars insertOne tests.
source/crud/tests/unified/insertOne-dots_and_dollars.json Regenerated JSON reflecting removal of pre-3.6 case.
source/crud/tests/unified/findOneAndUpdate-hint-clientError.yml Deletes pre-4.2-only unified test.
source/crud/tests/unified/findOneAndUpdate-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/findOneAndReplace-hint-clientError.yml Deletes pre-4.2-only unified test.
source/crud/tests/unified/findOneAndReplace-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/findOneAndReplace-dots_and_dollars.yml Removes pre-3.6 cases from dots-and-dollars findOneAndReplace tests.
source/crud/tests/unified/findOneAndReplace-dots_and_dollars.json Regenerated JSON reflecting removal of pre-3.6 cases.
source/crud/tests/unified/findOneAndDelete-hint-clientError.yml Deletes pre-4.2-only unified test.
source/crud/tests/unified/findOneAndDelete-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/find-allowdiskuse-clientError.yml Deletes pre-3.2-only unified test.
source/crud/tests/unified/find-allowdiskuse-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/deleteOne-hint-clientError.yml Deletes pre-3.4-only unified test.
source/crud/tests/unified/deleteOne-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/deleteMany-hint-clientError.yml Deletes pre-3.4-only unified test.
source/crud/tests/unified/deleteMany-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/bulkWrite-updateOne-hint-unacknowledged.yml Removes pre-4.2 bulkWrite hint cases; reanchors shared values.
source/crud/tests/unified/bulkWrite-updateOne-hint-unacknowledged.json Regenerated JSON reflecting removal of pre-4.2 cases.
source/crud/tests/unified/bulkWrite-updateMany-hint-unacknowledged.yml Removes pre-4.2 bulkWrite hint cases; reanchors shared values.
source/crud/tests/unified/bulkWrite-updateMany-hint-unacknowledged.json Regenerated JSON reflecting removal of pre-4.2 cases.
source/crud/tests/unified/bulkWrite-update-hint-serverError.yml Deletes pre-4.2-only unified test.
source/crud/tests/unified/bulkWrite-update-hint-serverError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/bulkWrite-update-hint-clientError.yml Deletes pre-3.4-only unified test.
source/crud/tests/unified/bulkWrite-update-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/bulkWrite-replaceOne-hint-unacknowledged.yml Removes pre-4.2 bulkWrite replaceOne hint cases; reanchors shared values.
source/crud/tests/unified/bulkWrite-replaceOne-hint-unacknowledged.json Regenerated JSON reflecting removal of pre-4.2 cases.
source/crud/tests/unified/bulkWrite-replaceOne-dots_and_dollars.yml Removes pre-3.6 cases from dots-and-dollars bulkWrite replaceOne tests.
source/crud/tests/unified/bulkWrite-replaceOne-dots_and_dollars.json Regenerated JSON reflecting removal of pre-3.6 cases.
source/crud/tests/unified/bulkWrite-delete-hint-clientError.yml Deletes pre-3.4-only unified test.
source/crud/tests/unified/bulkWrite-delete-hint-clientError.json Deletes generated JSON for removed unified test.
source/crud/tests/unified/bulkWrite-arrayFilters-clientError.yml Deletes pre-3.6-only unified test.
source/crud/tests/unified/bulkWrite-arrayFilters-clientError.json Deletes generated JSON for removed unified test.
source/compression/OP_COMPRESSED.md Removes pre-4.2 historical notes and updates compressor support wording.
source/command-logging-and-monitoring/tests/monitoring/redacted-commands.yml Removes tests for commands removed pre-4.2 (copydb*).
source/command-logging-and-monitoring/tests/monitoring/redacted-commands.json Regenerated JSON reflecting removal of copydb* cases.
source/command-logging-and-monitoring/tests/monitoring/pre-42-server-connection-id.yml Deletes pre-4.2-only connection-id unified test.
source/command-logging-and-monitoring/tests/monitoring/pre-42-server-connection-id.json Deletes generated JSON for removed connection-id test.
source/command-logging-and-monitoring/tests/logging/redacted-commands.yml Removes copydb* logging redaction cases.
source/command-logging-and-monitoring/tests/logging/redacted-commands.json Regenerated JSON reflecting removal of copydb* cases.
source/command-logging-and-monitoring/tests/logging/pre-42-server-connection-id.yml Deletes pre-4.2-only connection-id logging test.
source/command-logging-and-monitoring/tests/logging/pre-42-server-connection-id.json Deletes generated JSON for removed connection-id logging test.
source/collation/collation.md Removes pre-3.4/low-wire-version compatibility text now irrelevant to 4.2+.
source/client-side-encryption/tests/unified/maxWireVersion.yml Deletes pre-4.2-only CSFLE maxWireVersion unified test.
source/client-side-encryption/tests/unified/maxWireVersion.json Deletes generated JSON for removed CSFLE test.
source/client-side-encryption/tests/legacy/maxWireVersion.yml Deletes pre-4.2-only CSFLE legacy-format test.
source/client-side-encryption/tests/legacy/maxWireVersion.json Deletes generated JSON for removed legacy CSFLE test.
source/change-streams/change-streams.md Removes 4.0.7-specific notes around postBatchResumeToken.
source/causal-consistency/causal-consistency.md Removes 3.6+ phrasing now irrelevant to 4.2+ baseline.
source/bson-decimal128/decimal128.md Removes “MongoDB 3.4 introduces” phrasing; keeps generic Decimal128 requirements.
source/auth/auth.md Removes MONGODB-CR references and other pre-4.2 era version notes; simplifies defaults/mechanism sections.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 297 to 300
startTransaction SHOULD report an error if the driver can detect that transactions are not supported by the deployment.
A deployment does not support transactions when the deployment does not support sessions, or maxWireVersion < 7, or the
maxWireVersion < 8 and the topology type is Sharded, see
A deployment does not support transactions when the deployment does not support sessions, see
[How to Tell Whether a Connection Supports Sessions](../sessions/driver-sessions.md#how-to-tell-whether-a-connection-supports-sessions).
Note that checking the maxWireVersion does not guarantee that the deployment supports transactions, for example a
MongoDB 4.0 replica set using MMAPv1 will report maxWireVersion 7 but does not support transactions. In this case,
Drivers rely on the deployment to report an error when a transaction is started.

Comment on lines 463 to +466
Any command that marks the beginning of a transaction MAY include a `readConcern` argument with an optional `level` and
`afterClusterTime` fields. Read concern level 'local', 'majority', and 'snapshot' are all supported, although they will
all have the same behavior as "snapshot" in MongoDB 4.0. To support causal consistency, if `readConcern`
`afterClusterTime` is specified, then the server will ensure that the transaction’s read timestamp is after the
`afterClusterTime`.
`afterClusterTime` fields. Read concern level ‘local’, ‘majority’, and ‘snapshot’ are all supported. To support causal
consistency, if `readConcern` `afterClusterTime` is specified, then the server will ensure that the transaction’s read
timestamp is after the `afterClusterTime`.
Comment on lines +149 to +153
The only supported retryable write commands within a transaction are `commitTransaction` and `abortTransaction`.
Therefore drivers MUST NOT retry write commands within transactions even when `retryWrites` has been set to true on the
`MongoClient`. In addition, drivers MUST NOT add the `RetryableWriteError` label to any error that occurs during a write
command within a transaction (excepting `commitTransation` and `abortTransaction`), even when `retryWrites` has been set
to true on the `MongoClient`.
Comment thread source/auth/auth.md
Comment on lines 288 to 291
- username

SHOULD NOT be provided for MongoDB 3.4+ MUST be specified and non-zero length for MongoDB prior to 3.4
SHOULD NOT be provided

@NoahStapp NoahStapp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few other sections I saw that were missed:

  1. crud.md has many comments in pseudocode and interfaces that refer to unsupported server versions.
  2. transactions.md still has references to 4.0, such as "Starting in MongoDB 4.0, any command error may include a top level "errorLabels" field".
  3. The "Gossipping with mixed server versions" section in driver-sessions.md is no longer relevant now that all supported server versions support $clusterTime.
  4. The "Requirements for Retryable Reads" section in retryable-reads.md contains content only for server version < 3.6.
  5. The "timeoutMS cannot be overridden for startSession calls" section in client-side-operations-timeout.md references 3.6.
  6. The if isShutdown(code) or (error was from <4.2) pseudocode in server-discovery-and-monitoring.md.
  7. auth.md still has references to older versions, such as in the "Multi-credential drivers" section.
  8. The "Connection handshake" section in handshake.md.

Comment thread source/auth/auth.md

#### Conversation

1. Send `authenticate` command (MongoDB 3.4+)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Send `authenticate` command (MongoDB 3.4+)
1. Send `authenticate` command

]
```

Server version between 2.7.6 (inclusive) and 4.0 (exclusive) do not support the `nameOnly` option for the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire range is no longer supported and so this clarification should be removed.

Comment on lines 133 to 134
An algorithm is specified for inspecting error codes (MongoDB 3.6+) and falling back to parsing error messages when
error codes are unavailable (MongoDB 3.4 and earlier). When the client sees such an error it knows its topology view is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An algorithm is specified for inspecting error codes (MongoDB 3.6+) and falling back to parsing error messages when
error codes are unavailable (MongoDB 3.4 and earlier). When the client sees such an error it knows its topology view is
An algorithm is specified for inspecting error codes. When the client sees such an error it knows its topology view is

Comment thread source/auth/auth.md

If the handshake response includes a `saslSupportedMechs` field, then drivers MUST use the contents of that field to
select a default mechanism as described later. If the command succeeds and the response does not include a
`saslSupportedMechs` field, then drivers MUST use the legacy default mechanism rules for servers older than 4.0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4.0 is no longer supported, this distinction is not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants