Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
mongodb-6.18.0.tgz | 2025-07-22 | 831.3 kB | |
mongodb-6.18.0.tgz.sig | 2025-07-22 | 833 Bytes | |
README.md | 2025-07-22 | 5.4 kB | |
v6.18.0 source code.tar.gz | 2025-07-22 | 153.6 MB | |
v6.18.0 source code.zip | 2025-07-22 | 178.1 MB | |
Totals: 5 Items | 332.6 MB | 3 |
6.18.0 (2025-07-22)
The MongoDB Node.js team is pleased to announce version 6.18.0 of the mongodb
package!
Release Notes
New appendMetadata
API allows clients to add handshake metadata post construction
Driver information such as name, version, and platform are allowed:
:::ts
import { MongoClient } from 'mongodb';
const client = new MongoClient(process.env.MONGODB_URI);
client.appendMetadata({ name: 'my library', version: '1.0', platform: 'NodeJS' });
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()
and FindCursor.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=0
A MongoClient
configured with a maxIdleTimeMS
and minPoolSize
of 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 the ConnectionPool
implementation, idle / perished connections were not cleaned up unless minPoolSize
was non-zero.
With the changes in this PR, the ConnectionPool
now always cleans up idle connections, regardless of minPoolSize
.
ChangeStream event interfaces include a wallTime
property
This 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!
CommandSucceededEvent
and CommandFailedEvent
events now have a databaseName
property
CommandSucceededEvent
and CommandFailedEvent
now include the name of the database against which the command was executed.
Deprecations
Transaction state getters are deprecated
These were for internal use only and include:
:::ts
Transaction#options
Transaction#recoveryToken
Transaction#isPinned
Transaction#isStarting
Transaction#isActive
Transaction#isCommitted
ClientMetadata
, ClientMetadataOptions
, and CancellationToken
have been deprecated
These types will be removed in an upcoming major version of the driver.
CommandOptions.noResponse
is deprecated
[!CAUTION]
noResponse
is 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.
Features
- NODE-5055: Add databaseName property to command monitoring events (#4586) (3faf0c9)
- NODE-7009: add client metadata on demand (#4574) (b9636ee)
- NODE-7053: deprecate noResponse option (#4589) (1115319)
- NODE-6865: deprecate transaction getters (#4567) (da46aea)
- NODE-6991: deprecate unintentionally public client metadata types (#4566) (ca6554b)
Bug Fixes
- NODE-4845: allocate sessions lazily in cursors (#4575) (5761703)
- NODE-6589: background task does not prune idle connections when minPoolSize=0 (#4569) (7cbb641)
- NODE-6955: add missing
wallTime
property TS change stream event interfaces (#4541) (f153c6f)
Documentation
We invite you to try the mongodb
library immediately, and report any issues to the NODE project.