The MongoDB Go Driver 2.0 is Here and Ready for Production!
We’re excited to announce the official release of MongoDB Go Driver 2.0! A sincere thank you to all the developers who provided invaluable feedback during the beta phase.
What’s New in 2.0?
Version 2.0 brings several enhancements designed to improve your development experience:
Simplified Client Side Operations Timeout (CSOT) experience
OpenID Connect (OIDC) support
Cleaner, more idiomatic Go code
More descriptive and actionable error messages
A simplified package structure for easier navigation
New features will no longer be added to the 1.x versions. Critical bug fixes and security patches will continue to be backported to 1.x versions until January 15, 2026. After this date, support for 1.x versions will be discontinued.
How to Upgrade to 2.0
Ready to upgrade? Our migration guide provides detailed instructions to help you navigate the transition. Comprehensive documentation is also available on pkg.go.dev.
Questions? Feedback?
We’d love to hear from you! Share your questions and feedback on the MongoDB Community Forums, and don’t forget to tag them with “golang.”
Hi @Jack_Woehr, are you looking for a tutorial/example on something specific?
All of our documentation is kept up-to-date for each version (you can select the needed version in the dropdown at the top left). Our documentation includes multiple tutorials and code examples.
@Julia_Tazin, the quickstart example you point to seems to be incorrect for V2.
When I try to run the given code I get:
$ go run main.go
main.go:11:2: no required module provides package go.mongodb.org/mongo-driver/bson; to add it:
go get go.mongodb.org/mongo-driver/bson
main.go:12:2: no required module provides package go.mongodb.org/mongo-driver/mongo; to add it:
go get go.mongodb.org/mongo-driver/mongo
main.go:13:2: no required module provides package go.mongodb.org/mongo-driver/mongo/options; to add it:
go get go.mongodb.org/mongo-driver/mongo/options
If I try to add any of those packages, it pulls in the v1.17.2 driver
$ go get go.mongodb.org/mongo-driver/bson
go: added go.mongodb.org/mongo-driver v1.17.2