chore(main): release 6.18.0 #4554
Merged
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.
🌱 A new release!
6.18.0 (2025-07-22)
The MongoDB Node.js team is pleased to announce version 6.18.0 of the
mongodbpackage!Release Notes
Cursors lazily instantiate sessions
In previous versions, sessions were eagerly allocated whenever a cursor was created, regardless of whether or not a cursor was actually iterated (and the session was actually needed). Some driver APIs (
FindCursor.count(),AggregationCursor.explain()andFindCursor.explain()) don't actually iterate the cursor they are executed on. This can lead to client sessions being created and never being cleaned up.With this update, sessions are not allocated until the cursor is iterated.
Idle connections are now pruned during periods of no activity even when
minPoolSize=0A
MongoClientconfigured with amaxIdleTimeMSandminPoolSizeof 0 is advantageous for workloads that have sustained periods of little or no activity because it allows the connection pool to close connections that are unused during these periods of inactivity. However, due to a bug in theConnectionPoolimplementation, idle / perished connections were not cleaned up unlessminPoolSizewas non-zero.With the changes in this PR, the
ConnectionPoolnow always cleans up idle connections, regardless ofminPoolSize.CommandSucceededEventandCommandFailedEventevents now have adatabaseNamepropertyCommandSucceededEventandCommandFailedEventnow include the name of the database against which the command was executed.Transaction state getters are deprecated
These were for internal use only and include:
ClientMetadata,ClientMetadataOptions, andCancellationTokenhave been deprecated.These types will be removed in an upcoming major version of the driver.
New
appendMetadataAPI allows clients to add handshake metadata post constructionDriver information such as name, version, and platform are allowed:
CommandOptions.noResponseis deprecatedCaution
noResponseis not intended for use outside ofMongoClient.close(). Do not use this option.The Node driver has historically supported an option,
noResponse, that is used internally when a MongoClient is closed. This option was accidentally public. This option will be removed in an upcoming major release.ChangeStream event interfaces include a
wallTimepropertyThis property is available on all types with the exception of reshard collection and refine collection shard key events. Thanks to @qhello for bringing this bug to our attention!
Features
Bug Fixes
wallTimeproperty TS change stream event interfaces (#4541) (f153c6f)Documentation
We invite you to try the
mongodblibrary immediately, and report any issues to the NODE project.