Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Empty timeoutMS URI values still throw instead of being ignored, and removing the public MongoOptions.timeoutMS member breaks existing TypeScript code.
2 open issues
What changed in this PR
This PR deprecates timeoutMS and timeoutMode in the MongoDB Node.js driver and makes them no-ops, directing applications to the existing per-stage timeouts.
Changes:
- Disables client-side operation timeout creation and propagation across operations, sessions, cursors, change streams, and GridFS.
- Adds deprecation annotations and a client-level warning, and removes obsolete timeout validation.
- Updates no-op coverage and skips tests that require the retired timeout behavior.
| File | Description |
|---|---|
test/unit/utils.test.ts |
Tests ignored timeout options and preserved write concern timeouts. |
test/unit/timeout.test.ts |
Expects legacy timeout contexts despite timeoutMS. |
test/unit/sessions.test.ts |
Updates session timeout inheritance expectations. |
test/unit/mongo_client.test.ts |
Tests ignored client and URI timeout values. |
test/unit/cursor/aggregation_cursor.test.ts |
Skips obsolete cursor timeout guard tests. |
test/unit/client-side-encryption/client_encryption.test.ts |
Expects no explicit encryption timeout setting. |
test/unit/assorted/uri_options.spec.test.ts |
Adjusts URI expectations for ignored timeoutMS. |
test/integration/read-write-concern/write_concern.test.ts |
Skips timeout-dependent write concern tests. |
test/integration/node-specific/timeout_ms_noop.test.ts |
Adds operation-level no-op integration coverage. |
test/integration/node-specific/auto_connect.test.ts |
Skips timeout-dependent auto-connect tests. |
test/integration/node-specific/abstract_cursor.test.ts |
Skips externally supplied timeout context tests. |
test/integration/crud/find_cursor_methods.test.ts |
Uses a legacy context in cursor tests. |
test/integration/crud/explain.test.ts |
Skips timeout-dependent explain tests. |
test/integration/crud/client_bulk_write.test.ts |
Unconditionally skips client-side timeout tests. |
test/integration/client-side-operations-timeout/node_csot.test.ts |
Skips driver-specific operation timeout tests. |
test/integration/client-side-operations-timeout/client_side_operations_timeout.unit.test.ts |
Skips operation timeout specification unit tests. |
test/integration/client-side-operations-timeout/client_side_operations_timeout.spec.test.ts |
Excludes retired timeout specs while retaining legacy filtering. |
test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts |
Skips operation timeout prose tests. |
test/integration/client-side-encryption/driver.test.ts |
Skips encryption timeout suites. |
test/integration/client-side-encryption/client_side_encryption.prose.28.kms_connect_callback.test.ts |
Skips the callback timeout case. |
src/utils.ts |
Stops propagating timeoutMS and preserves write concern timeouts. |
src/timeout.ts |
Removes client-side timeout context creation from the factory. |
src/sessions.ts |
Removes session timeout inheritance and transaction deadline creation. |
src/operations/run_command.ts |
Deprecates the command timeout option. |
src/operations/operation.ts |
Deprecates the shared operation timeout option. |
src/operations/command.ts |
Removes explain timeout conflict validation. |
src/mongo_client.ts |
Disables the timeout getter and updates timeout declarations and documentation. |
src/gridfs/upload.ts |
Removes upload timeout context creation. |
src/gridfs/index.ts |
Deprecates bucket timeout options. |
src/gridfs/download.ts |
Removes download timeout context creation. |
src/explain.ts |
Removes the obsolete timeout conflict validator. |
src/db.ts |
Drops stored database timeouts and updates documentation. |
src/cursor/run_command_cursor.ts |
Deprecates command cursor timeout options. |
src/cursor/find_cursor.ts |
Removes find explain timeout conflict validation. |
src/cursor/aggregation_cursor.ts |
Removes aggregation explain timeout conflict validation. |
src/cursor/abstract_cursor.ts |
Removes cursor timeout propagation, validation, and close overrides. |
src/connection_string.ts |
Accepts and ignores timeoutMS with a deprecation warning. |
src/collection.ts |
Disables the timeout getter and updates documentation. |
src/client-side-encryption/kms_options.ts |
Deprecates the callback timeout field. |
src/client-side-encryption/client_encryption.ts |
Replaces timeout behavior documentation with a deprecation notice. |
src/change_stream.ts |
Removes change stream timeout context creation. |
Review effort: Balanced
Mark `timeoutMS` as deprecated and note its future removal. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
johnmtll
reviewed
Oct 29, 2026
johnmtll
left a comment
Contributor
There was a problem hiding this comment.
In src/client-side-encryption/client_encryption.ts, we remove the description for timeoutMS entirely, in other files, we retain it (e.g: src/cursor/abstract_cursor.ts).
Can we maintain consistency by either keeping it or removing it everywhere it's deprecated?
johnmtll
reviewed
Oct 29, 2026
johnmtll
requested changes
Oct 29, 2026
PavelSafronov
requested changes
Oct 29, 2026
johnmtll
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Summary of Changes
timeoutMSandtimeoutModeare now deprecated no-ops. They are still accepted everywhere (client options, URI,Db,Collection, operations, etc.) but ignored, so passing them sets nothing and never throws. A CSOT timeout context can no longer be created, and every operation uses the legacy timeouts (serverSelectionTimeoutMS,waitQueueTimeoutMS,socketTimeoutMS,maxTimeMS), which are unchanged.Notes for Reviewers
CursorTimeoutModeand the cursor guards are now unreachable. They are left in place for the removal work.NODE-7958: timeoutMS is a no-op.timeoutMS. Warnings for per-operationtimeoutMS,timeoutModeandMongoOperationTimeoutErrorare tracked in NODE-7871.Release Highlight
timeoutMSis deprecated and now a no-opWarning
timeoutMSandtimeoutModeare deprecated and have no effect starting in this release. They are still accepted and will not throw, but operations will no longer time out because of them. They are slated for removal in a future release.Use the per-stage timeouts instead:
serverSelectionTimeoutMS,waitQueueTimeoutMS,socketTimeoutMS, andmaxTimeMSfor server-side execution.Double check the following
npm run check:lint)type(NODE-xxxx)[!]: descriptionfeat(NODE-1234)!: rewriting everything in coffeescript