yarn mongodb 4.9.0
v4.9.0

latest releases: 6.10.0-dev.20241113.sha.20564f7a, 6.10.0-dev.20241112.sha.48ed47ec, 6.10.0-dev.20241109.sha.ed25d561...
2 years ago

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

Release Highlights

We have corrected an inconsistency with our writeConcern options in the type definitions where the MongoClient alleged to not support "writeConcern" as an option. In fact, it did support it at run time and now the types correctly reflect that, along with the corresponding deprecations we made to the nested writeConcern config settings.

Our index specification handling had a few peculiar edge cases that we have detailed below, we believe these are unlikely to affect a vast majority of users as the type definitions would have likely reported an error with the impacted usage. As a feature, the typescript definitions now support a javascript Map as a valid input for an index specification.

Index Specification Detailed Fixes
  • Map as a valid input type in TS definition
  • Uses Map under the hood to ensure key order is preserved, fixed numeric index key order issue in combination with FLE usage
  • Tuples passed at the top level to createIndex were incorrectly parsed as string input
    • createIndex(['myKey', 1]) would create { 'myKey': 1, '1': 1 }.
    • Now it's correctly detected if the second arg is one of the known index directions.
    • For complex programmatic generation of indexes we recommend using a Map to avoid all the edge cases here.
  • Type strictness on this nesting of array (one or more)
  • Type strictness for createIndexes aligned with createIndex
    • No longer accepts just Document, checks that the values are a known IndexDirection

As per usual this release brings in the latest BSON release (v4.7.0) which added automatic UUID support. You can read more about that in the BSON release notes here!

Special thanks to the folks who contributed to this release!

Features

Bug Fixes

Documentation

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

Don't miss a new mongodb release

NewReleases is sending notifications on new releases.