-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Component/s: Multiple
-
None
-
Needed
Since MongoDB 4.2 is the minimum supported server version for current drivers, all spec tests that are gated to only run on servers older than 4.2 can be removed. Additionally, spec prose that describes conditional behavior for pre-4.2 servers can be simplified. And finally, references to pre-4.2 behavior can be removed from the specifications themselves.
Note that the below was generated by Claude. I verified everything but it's possible that things were missed.
Entire test files to remove
These files have a file-level runOnRequirements with maxServerVersion < 4.2, meaning they can never run against a supported server.
CRUD tests (source/crud/tests/unified/)
Each YAML file has a corresponding JSON file that should also be removed.
< 3.2 (maxServerVersion: "3.0.99")
- find-allowdiskuse-clientError.yml — client error for allowDiskUse on pre-3.2 servers
< 3.4 (maxServerVersion: "3.3.99")
- bulkWrite-update-hint-clientError.yml
- bulkWrite-delete-hint-clientError.yml
- deleteOne-hint-clientError.yml
- deleteMany-hint-clientError.yml
- updateOne-hint-clientError.yml
- updateMany-hint-clientError.yml
< 3.6 (maxServerVersion: "3.5.5")
- bulkWrite-arrayFilters-clientError.yml — client error for arrayFilters on pre-3.6 servers
< 4.2 (maxServerVersion: "4.0.99")
- findOneAndReplace-hint-clientError.yml
- findOneAndDelete-hint-clientError.yml
- findOneAndUpdate-hint-clientError.yml
< 4.2 (maxServerVersion: "4.1.9")
- updateMany-hint-serverError.yml
- updateOne-hint-serverError.yml
- bulkWrite-update-hint-serverError.yml
Command logging and monitoring tests
< 4.2 (maxServerVersion: "4.0.99")
- logging/pre-42-server-connection-id.yml (.json)
- monitoring/pre-42-server-connection-id.yml (.json)
Client-side encryption tests
< 4.2 (maxServerVersion: "4.0.99")
- unified/maxWireVersion.yml (.json)
SDAM error handling tests (source/server-discovery-and-monitoring/tests/errors/)
All 8 pre-42-* files use maxWireVersion: 7 (< MongoDB 4.2). Each has a YAML and JSON variant (16 files total). These are auto-generated by generate-error-tests.py.
- pre-42-InterruptedAtShutdown.yml (.json)
- pre-42-InterruptedDueToReplStateChange.yml (.json)
- pre-42-LegacyNotPrimary.yml (.json)
- pre-42-NotPrimaryNoSecondaryOk.yml (.json)
- pre-42-NotPrimaryOrSecondary.yml (.json)
- pre-42-NotWritablePrimary.yml (.json)
- pre-42-PrimarySteppedDown.yml (.json)
- pre-42-ShutdownInProgress.yml (.json)
Also removable:
- pre-42.yml.template
- The create_pre_42_tests() function in generate-error-tests.py
Individual tests to remove from files that also contain valid tests
These files contain a mix of tests for pre-4.2 and 4.2+ servers. Only the pre-4.2 tests should be removed.
Dots-and-dollars tests with maxServerVersion: "3.4.99" (source/crud/tests/unified/)
- replaceOne-dots_and_dollars.yml — 2 tests
- bulkWrite-replaceOne-dots_and_dollars.yml — 2 tests
- insertOne-dots_and_dollars.yml — 1 test
- findOneAndReplace-dots_and_dollars.yml — 2 tests
Hint unacknowledged tests with maxServerVersion: "4.0.99" (source/crud/tests/unified/)
- bulkWrite-updateOne-hint-unacknowledged.yml — 2 tests
- updateOne-hint-unacknowledged.yml — 2 tests
- updateMany-hint-unacknowledged.yml — 2 tests
- bulkWrite-updateMany-hint-unacknowledged.yml — 2 tests
- bulkWrite-replaceOne-hint-unacknowledged.yml — 2 tests
- replaceOne-hint-unacknowledged.yml — 2 tests
Dead tests in redacted-commands (file requires minServerVersion: "5.0" but tests capped below 4.2, so they can never execute)
- source/command-logging-and-monitoring/tests/logging/redacted-commands.yml — 6 dead tests (copydbgetnonce capped at 3.6.99, copydbsaslstart and copydb capped at 4.0.99)
- source/command-logging-and-monitoring/tests/monitoring/redacted-commands.yml — 3 dead tests (copydbgetnonce capped at 3.6.99, copydbsaslstart and copydb capped at 4.0.99)
Spec prose to simplify or remove
The following spec documents contain conditional language or requirements that reference pre-4.2 server behavior. Since 4.2 is now the minimum supported version, these can be simplified to only describe the 4.2+ behavior.
server-discovery-and-monitoring/server-discovery-and-monitoring.md
Line 938 — Pool clearing on primary stepdown is conditional on server version:
If the old primary server version is 4.0 or earlier, the client MUST clear its connection pool for the old primary, too: the connections are all bad because the old primary has closed its sockets. If the old primary server version is 4.2 or newer, the client MUST NOT clear its connection pool for the old primary.
Simplify to: the client MUST NOT clear its connection pool for the old primary.
Line 1881 — Describes pre-4.2 stepdown behavior:
On MongoDB 4.0 and earlier, a primary closes its connections when it steps down, so in many cases the next operation will experience a connection error.
Can be removed (only 4.2+ behavior is relevant now).
server-discovery-and-monitoring/server-discovery-and-monitoring-summary.md
Line 133-137 — Mirrors the main SDAM spec's pre-4.2 pool clearing conditional:
pool for the server if the server is 4.0 or earlier, and MUST NOT clear its connection pool for the server if the server...
Simplify to match the main spec update.
collation/collation.md
Lines 140-183 — Requires maxWireVersion >= 5 (MongoDB 3.4) for collation support. Since 4.2 (wire version 8) is the minimum, all supported servers support collation. The version check and associated error-raising logic can be removed:
Drivers MUST require the server's maxWireVersion >= 5 to support Collations. When a collation is explicitly specified for a server with maxWireVersion < 5, the driver MUST raise an error.
The driver must inspect each operation for a Collation if maxWireVersion is < 5 and fail the entire bulkWrite if a collation was explicitly specified.
auth/auth.md
Lines 336-348 — MONGODB-X509 has different behavior for MongoDB 3.4 vs 3.2 and earlier (whether username must be sent). Since 4.2 >> 3.4, only the 3.4+ behavior applies:
When connected to MongoDB 3.2 or earlier:
- You MUST send a username to the server.
- If no username is provided by the application, you MAY extract the username from the X.509 certificate...
Remove the 3.2 branch entirely.
Line 374 — Username requirement is conditional on version:
SHOULD NOT be provided for MongoDB 3.4+ MUST be specified and non-zero length for MongoDB prior to 3.4
Simplify to: SHOULD NOT be provided.
transactions/transactions.md
Lines 232-235 — Read preference restriction described as MongoDB 4.0-specific:
In MongoDB 4.0, transactions may only read from the primary. If a read is attempted and the transaction's read preference is not Primary drivers MUST raise an error...
Remove the "In MongoDB 4.0" qualifier.
Lines 297-303 — Transaction support check references maxWireVersion < 7 (pre-4.0) and maxWireVersion < 8 (pre-4.2 for sharded):
maxWireVersion < 7, or the maxWireVersion < 8 and the topology type is Sharded
a MongoDB 4.0 replica set using MMAPv1 will report maxWireVersion 7 but does not support transactions
The maxWireVersion < 7 check can be removed (always >= 8 now). The MMAPv1 note can be removed (MMAPv1 was removed in 4.2).
Lines 456, 464 — Describe read concern snapshot as "new in MongoDB 4.0". Can remove the version qualifier.
Lines 556-558 — Retryable writes within transactions described as "In MongoDB 4.0 the only supported retryable write commands...". Remove version qualifier (this is still the current behavior).
Lines 922-939 — Design rationale discusses 4.0 vs 4.2 read preference behavior. Can be simplified now that 4.2+ is assumed.
retryable-writes/retryable-writes.md
Lines 81-85 — Supported server versions references MongoDB 3.6 and feature compatibility version 3.6:
Like sessions, retryable writes require a MongoDB 3.6 replica set or shard cluster operating with feature compatibility version 3.6
Can simplify to just reference wire version / logicalSessionTimeoutMinutes without the 3.6-specific language.
Lines 87-89 — MMAPv1 compatibility note:
Retryable writes are only supported by storage engines that support document-level locking. Notably, that excludes the MMAPv1 storage engine which is available in both MongoDB 3.6 and 4.0.
MMAPv1 was removed in 4.2. This entire paragraph and the associated error message requirement can be removed.
Lines 135-153 — Describes unsupported write operations as "will not be initially supported by MongoDB 3.6, although this may change in the future." Can be updated to reflect current state.
Lines 157-161 — "In MongoDB 4.0 the only supported retryable write commands within a transaction..." Remove version qualifier.
read-write-concern/read-write-concern.md
Lines 82-85 — readConcern support for aggregate with write stage:
Starting in MongoDB 4.2, an aggregate command with a write stage (e.g. $out, $merge) supports a readConcern...
Server versions before 4.2 do not support a readConcern at all for aggregate commands with a write stage.
Since 4.2 is the minimum, the "before 4.2" note can be removed.
find_getmore_killcursors_commands/find_getmore_killcursors_commands.md
Lines 96-108 — Exhaust cursor table has a "4.0 and earlier" row requiring legacy OP_QUERY. This row can be removed since 4.2 is the minimum.
message/OP_MSG.md
Lines 20-25 — OP_MSG availability described as "only available in MongoDB 3.6 (maxWireVersion >= 6) and later" with fallback to OP_QUERY for drivers that supported 3.4 and earlier. Since 4.2 is minimum, OP_MSG is always available and the OP_QUERY fallback language can be removed.
change-streams/change-streams.md
Lines 321, 339, 781 — References to postBatchResumeToken being introduced in MongoDB 4.0.7. Since 4.2 is the minimum, this feature is always available and the version qualifier can be removed.
unified-test-format/unified-test-format.md
Lines 329-331 — "sharded-replicaset" deprecation note says "MongoDB 3.6+ requires that all shard servers be replica sets." Since 4.2 > 3.6, this is always true. The deprecation note can be simplified.
index-management/index-management.md
Lines 713, 786, 791 — References to features being new in MongoDB 3.0, 3.2, 3.4. These are informational version annotations that could be removed since all are below the minimum.
compression/OP_COMPRESSED.md
Lines 170-419 — Extensive Q&A and behavioral notes referencing MongoDB 3.0, 3.4, 3.6 compression support. Can be simplified since all supported servers (4.2+) support snappy, zlib, and zstd.
enumerate-collections/enumerate-collections.md
Lines 146, 167 — "MongoDB 4.0 introduced a nameOnly boolean option..." and "MongoDB 4.0 also added an authorizedCollections boolean option...". Since 4.2 > 4.0, these are always available. Version qualifiers can be removed.
enumerate-databases/enumerate-databases.md
Lines 68, 141 — "MongoDB 4.0.5 added an authorizedDatabases boolean option..." and "MongoDB 3.6 introduced a nameOnly boolean option...". Version qualifiers can be removed.
causal-consistency/causal-consistency.md
Lines 199, 286, 376 — References to 3.6+ servers supporting cluster times and causal consistency. Since 4.2 > 3.6, this is always true and the version qualifiers can be removed.
mongodb-handshake/handshake.md
Lines 10, 117 — "MongoDB 3.4 has the ability to annotate connections with metadata..." Version qualifier can be removed.
bson-decimal128/decimal128.md
Line 10 — "MongoDB 3.4 introduces a new BSON type...". Version qualifier can be removed.
Summary
| Category | Count |
|---|---|
| Entire test files to remove | 18 YAML + 18 JSON + 1 template = 37 files |
| Individual tests to remove | 28 tests across 12 files |
| Spec documents with prose to simplify | 16 documents |