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
createIndex
were incorrectly parsed as string input
createIndex(['myKey', 1])
would create { 'myKey': 1, '1': 1 }
.
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!
- @sampaiodiego for the
oplogReplay
flag support fix - @jer-sen for typescript Filter definition improvements
- @aditi-khare-mongoDB for index specification fixes / type improvements
Features
- NODE-3517: improve index spec handling and type definitions (#3315) (0754bf9)
- NODE-4336: deprecate old write concern options and add missing writeConcern to MongoClientOptions (#3340) (d2b6ad8)
Bug Fixes
- NODE-4159,NODE-4512: remove servers with incorrect setName from topology and fix unix socket parsing (#3348) (00dcf2d)
- NODE-4273: pass 'comment' option through to distinct command (#3339) (753ecfe)
- NODE-4413: set maxTimeMS on getMores when maxAwaitTimeMS is specified (#3319) (dcbfd6e)
- NODE-4429: select server sync for endSessions during close (#3363) (5086ead)
- NODE-4467: Add back support for
oplogReplay
option as deprecated (#3337) (6c69b7d) - NODE-4496: counter values incorrectly compared when instance of Long (#3342) (d29eb8c)
- NODE-4513: type for nested objects in query & update (#3349) (ec1a68f)
Documentation
- Reference: https://docs.mongodb.com/drivers/node/current/
- API: https://mongodb.github.io/node-mongodb-native/4.8
- Changelog: https://github.com/mongodb/node-mongodb-native/blob/main/HISTORY.md
We invite you to try the mongodb library immediately, and report any issues to the NODE project.