MongoDB Node.js Driver v4.2.0 Released

Release Highlights

This release includes a number of features we’re happy to announce. You can now run aggregate pipelines that write to MongoDB using $out and $merge stages on secondaries! We’ve added an option to limit the number of hosts the driver will connect to when using SRV DNS lookups to manage your host addresses. And lastly, the authorizedCollection option is now usable on the db.listCollections() function.

Additionally, in this release, we’ve marked collection.mapReduce() as deprecated. The same functionality can be replicated in the much more flexible aggregation pipeline! Take a look at the documentation here: Map-Reduce to Aggregation Pipeline

The minimum supported MongoDB version is 3.6. Attempts to connect to a MongoDB server older than 3.6 will result in an error.
Please take note of the MongoDB Software Lifecycle Schedules for timeframes of supported server versions.

Features

  • NODE-3083: support aggregate writes on secondaries (#3022) (f696909)
  • NODE-3446: deprecate mapReduce command (#3036) (b6c73bf)
  • NODE-3467: implement srvMaxHosts, srvServiceName options (#3031) (1f8b539)
  • NODE-3469,NODE-3615,NODE-3507: update min and max wire versions (#3014) (2a78d5a)
  • NODE-3691: make time series options granularity type strict (#3005) (98017f9)
  • NODE-3692: make change stream events typing more generic (#3034) (d5ae78e)
  • NODE-3728: Allow to pass authorizedCollections option to the db.listCollections method (#3021) (e1234a7)
  • NODE-3729: add withId to default return type for collection.find and collection.findOne (#3039) (52520aa)

Bug Fixes

  • NODE-3116: reschedule unreliable async interval first (#3006) (33886a7)
  • NODE-3344: allow setting defaultTransactionOptions with POJO rather than ReadConcern instance (#3032) (53b3164)
  • NODE-3515: do proper opTime merging in bulk results (#3012) (43300c3)
  • NODE-3668: compile error with OptionalId on TS 4.5 beta (#3004) (ee7f095)
  • NODE-3726: add optional option overloads of Db’s createCollection function (#3019) (c3149e1)
  • NODE-3727: add overloads for BulkOperationBase’s execute function (#3018) (216d194)

Documentation

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

1 Like