Skip to content

@divjotarora divjotarora released this Feb 5, 2020 · 18 commits to master since this release

The MongoDB Go driver team is pleased to release 1.3.0 of the official Go driver.

This release contains new functions to construct BSON registries, a new BSON registry that mimics the behavior of the globalsign/mgo/bson library, and new URI options to specify TLS certificates and keys as separate files. As part of this release, support for Go modules has been added and the README has been changed to reflect this. There is still a vendor directory in the source code so projects can be compiled with versions of Go that do not support modules.

Documentation can be found on GoDoc and the MongoDB documentation site. BSON library documentation is also available on GoDoc. Questions and inquiries can be asked on the mongo-go-driver Google Group. Bugs can be reported in the Go Driver Jira where a list of current issues can be found.

mgo compatible BSON

A new mgocompat package has been added under the top-level bson package. This package exports Registry, which is a BSON registry compatible with globalsign/mgo/bson and RegistryRespectNilValues, which is compatible with globalsign/mgo/bson with the RespectNilValues flag set to true. These registries can be used via the ClientOptions.SetRegistry method. The package also exports a RegistryBuilder for each of the registries so additional changes can be made. See the bson/bsoncodec package documentation for more information.

RegistryBuilder method changes

The existing RegisterEncoder methods has been deprecated and replaced by RegisterTypeEncoder and RegisterHookEncoder. A corresponding change has been made for RegisterDecoder as well.

Release Notes


  • [GODRIVER-1002] - Credential.PasswordSet doesn't work or is incorrectly documented
  • [GODRIVER-1411] - Data race between creating a new connection and disconnecting topology
  • [GODRIVER-1466] - Overriding the type map entry for embedded document does not work
  • [GODRIVER-1476] - mongodb+srv doesn't work with a fully qualified DNS name
  • [GODRIVER-1478] - Pooled sessions should have use time updated when retrieved from the pool

New Feature

  • [GODRIVER-580] - Need to be able to unmarshall to bson.D field within a struct
  • [GODRIVER-917] - Difference in BSON/JSON serialization of nil primitive.D compared to mgo
  • [GODRIVER-1175] - allow BSON null values to decode into non-nilable Go types
  • [GODRIVER-1354] - Create ObjectIDCodec that accepts bsontype.String for decoding
  • [GODRIVER-1356] - Support mgo's Getter and Setter interfaces
  • [GODRIVER-1358] - Add UIntCodec for mgocompat
  • [GODRIVER-1361] - Create mgocompat.Registry
  • [GODRIVER-1362] - Add SliceCodec for mgocompat


  • [GODRIVER-904] - Improve docs for how to write custom codecs
  • [GODRIVER-938] - cannot convert types that use mgobson.ObjectId to new bson library.
  • [GODRIVER-1381] - GridFS GoDoc examples
  • [GODRIVER-1427] - Add more sessions tests with more read and write commands
  • [GODRIVER-1448] - Read operations options documentation


  • [GODRIVER-543] - Enable support for Go 1.11 modules
  • [GODRIVER-1421] - Add EmptyInterfaceCodec for mgocompat
  • [GODRIVER-1429] - add ByteArrayCodec for mgocompat
  • [GODRIVER-1430] - allow strings and binaries to decode to symbols
  • [GODRIVER-1433] - Add RespectNilValues equivalent for the mgo registry
  • [GODRIVER-1435] - Please add tlsCertificateFile and tlsKeyFile connection string options.
  • [GODRIVER-1438] - Separate RegisterEncoder/Decoder functions to "types" and "hooks"
  • [GODRIVER-1455] - Use a pure go implementation for zstd
  • [GODRIVER-1460] - Document mgocompat
  • [GODRIVER-1461] - Validate that mongocryptd is not spawned if bypassAutoEncryption=true
Assets 2
You can’t perform that action at this time.