MongoDB Go Driver Mgo Gets Special Release


TL;DR: MongoDB Go driver has moved and developers will want to update their code.

There's a lot of MongoDB drivers out there, both official and unofficial, and mgo is one of the stars of those drivers. If you've not come across mgo, it's a driver written for the Go language. It has taken its API design cues from Go rather than be driven to a common spec. That can make it look unfamiliar to anyone coming from another language and one of the official drivers, but it does mean it is perfect for Go developers and has become a firm favourite with its cluster discovery, failover management, pre-fetching of results, pooling-aware authentication and GridFS support.

The announcement of the latest version explains the cause of this special release; mgo is changing how its hosted, how developers import it and how to get the library. The package import path is changing to as the library changes its distribution path from a static file on the servers to the geographically distributed To get the library, users will now need to run go get

Who's you ask? It's actually's latest project for supplying stable versioned APIs to Go developers. The service uses git and in the background. That also means that the mgo source code is now only residing on github and you don't need to build bzr to download it. Old import paths and source repositories will continue to work, but you'll want to update as soon as you can as the old repos are "already holding out-of-date code". We've updated our Go documentation already.

There are new features in the release too:

There's also the first elements of a Bulk API to match MongoDB 2.6's bulk operations. Right now its experimental and just supports bulk inserts by allowing the operations to be queued up and run in an ordered or unordered mode. It's laying the foundations for a more complete Bulk operations API in the future.

It's also interesting to note that although it is an unofficial driver, some of the credited feature requests and many of the problems reports came from MongoDB, with a patch coming from Facebook and a request from Canonical. MongoDB Inc It looks like MongoDB Inc are paying attention to one of our favourite drivers here at MongoHQ.

Dj Walker-Morgan
Dj Walker-Morgan was Compose's resident Content Curator, and has been both a developer and writer since Apples came in II flavors and Commodores had Pets. Love this article? Head over to Dj Walker-Morgan’s author page to keep reading.

Conquer the Data Layer

Spend your time developing apps, not managing databases.