github mongodb/mongo-go-driver v2.0.0
MongoDB Go Driver 2.0.0

18 hours ago

The MongoDB Go Driver Team is pleased to release version 2.0.0 of the official MongoDB Go driver.

Release Notes

This release includes a host of new features and several breaking changes. Below, we provide an overview of the key highlights, changes, and guidance for migrating from version 1.x to 2.0.

This release includes several breaking changes that users must account for when upgrading, including:

  • Options Package: The approach to managing options has been restructured to use a builder pattern, changing how options are constructed and applied. This alteration allows for more flexible and dynamic option configurations, but may require changes to existing code that directly manipulates options objects.
  • Mongo Package: The Client.Connect() method has been removed, favoring mongo.Connect() to streamline connection handling.
  • Event Package: References to the description package have been transitioned to event.ServerDescription and event.TopologyDescription, impacting how server and topology details are accessed and manipulated.
  • BSON Package Consolidation: All previously separate BSON-related packages, including bsoncodec, bsonoptions, bsonrw, and mgocompat, have been merged into the single bson package. Many functionalities from these packages have been reorganized or renamed. For instance, bson.NewRegistryBuilder has been replaced with new APIs tailored for registry configuration, and interfaces like ValueReader and ValueWriter are now part of the consolidated bson package. This consolidation simplifies the package structure but requires updates to import paths and related logic.

To ease the transition to 2.0, a comprehensive migration guide has been provided. This guide includes detailed instructions to navigate the changes, including the updated options pattern, altered imports, and revised method signatures.

Additionally, this release deprecates support for MongoDB server versions below 3.6. Support for MongoDB 3.6 will be dropped in a future update.

We express our gratitude to our contributors and the community for all the support in developing this release.


For a full list of tickets included in this release, please see the links below:

Full Changelog: v1.17.1...v2.0.0

Documentation for the Go driver can be found on pkg.go.dev and the MongoDB documentation site. BSON library documentation is also available on pkg.go.dev. Questions and inquiries can be asked on the MongoDB Developer Community. Bugs can be reported in the Go Driver project in the MongoDB JIRA where a list of current issues can be found. Your feedback on the Go driver is greatly appreciated!

Don't miss a new mongo-go-driver release

NewReleases is sending notifications on new releases.