The MongoDB Node.js team is pleased to announce version 4.8.0 of the mongodb package!
Release Highlights
UpdateFilter nested fields
In this release you will now get auto-complete and type safety for nested keys in an update filter. See the example below:
Optional client.connect()
fixup
In our last release we made explicitly calling client.connect()
before performing operations optional with some caveats. In this release client.startSession()
can now be called before connecting to MongoDB.
NOTES:
- The only APIs that need the client to be connected before using are the legacy
collection.initializeUnorderedBulkOp()
/collection.initializeOrderedBulkOp()
builder methods. However, the preferredcollection.bulkWrite()
API can be used without calling connect explicitly.- While executing operations without explicitly connecting may be streamlined and convenient, depending on your use case
client.connect()
could still be useful to find out early if there is some easily detectable issue (ex. networking) that prevents you from accessing your database.
Features
- NODE-4078: allow comment with estimated doc count (#3301) (bed1fe3)
- NODE-4267: support nested fields in type completion for UpdateFilter (#3259) (1a9a44c)
Bug Fixes
- NODE-4125: change stream resumability (#3289) (aa5f97e)
- NODE-4262: make startSession work without a connection (#3286) (89ad7c3)
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.