Skip to content

v6.16.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 21 Apr 18:57
b648a63

6.16.0 (2025-04-21)

The MongoDB Node.js team is pleased to announce version 6.16.0 of the mongodb package!

Release Notes

distinct commands now support an index hint

The Collection.distinct() method now supports an optional hint, which can be used to tell the server which index to use for the command:

// providing an index description
await collection.distinct('my-key', { 
  hint: { 'my-key': 1 }
});

// providing an index name
await collection.distinct('my-key', { 
  hint: 'my-key'
});

This requires server 7.1+.

Driver support for servers <=4.0 deprecated

Warning

Node driver support for server 4.0 will be removed in an upcoming minor release. Reference: MongoDB Software Lifecycle Schedules.

Fix processing of multiple messages within one network data chunk

During elections, or other scenarios where the server is pushing multiple topology updates to the driver in a short period of time, a bug in the driver's socket code led to backlog of topology updates that would remain in the buffer until another heartbeat arrived from the server. This could lead to delays in the driver recovering from an election and/or an increase in MongoServerSelectionErrors.

Now, all messages in the current buffer are returned to the driver leading to faster processing times.

Huge thank you to @andreim-brd for sharing a self-contained reproduction that proved to be instrumental in the identification of the underlying issue!

FindCursor.rewind() throws documents?.clear() is not a function errors in certain scenarios

In certain scenarios where limit and batchSize are both set on a FindCursor, an internal driver optimization intended to prevent unnecessary requests to the server when the driver knows the cursor is exhausted would prevent the cursor from being rewound. This issue has been resolved.

Features

Bug Fixes

Documentation

We invite you to try the mongodb library immediately, and report any issues to the NODE project.