Docs Menu
Docs Home
/ / /
Go Driver

What's New

On this page

  • What's New in 1.14
  • What's New in 1.13
  • What's New in 1.12.1
  • What's New in 1.12

Tip

Release Notes

To learn more about changes and updates between versions, you can read the release notes published with the driver source code.

Learn what's new in:

The 1.14 Go driver release includes the following improvements and fixes:

  • Go versions before 1.18 are no longer supported.

  • In case of a heartbeat timeout, in-progress operations are preemptively canceled.

  • Connection strings that include the "mongodb+srv://" prefix can contain capital letters in the SRV hostname.

The 1.13 Go driver release includes the following improvements and fixes:

  • Logging for server selection and SDAM. To learn more about logging, see the Logging documentation.

  • Methods on the Collection type that allow you to manage search indexes programmatically.

  • The event.CommandStartedEvent and event.CommandFinishedEvent events return the DatabaseName field. This field is also included in the command-logging analogs.

  • In a sharded topology, when selecting a server to retry an unsuccessful query, the driver excludes the server used for the initial attempt. Instead, if there's more than one eligible mongos instance, the driver randomly selects one. Unhealthy instances are automatically excluded from selection.

  • Streaming SDAM is disabled by default on AWS Lambda and similar function-as-a-service (FaaS) platforms. You can enable monitoring by using the serverMonitoringMode URI option.

The 1.12 Go driver release includes the following improvements and fixes:

  • The driver unpins connections when ending a session. This prevents connections from leaking when a user runs a transaction while connected to a load balancer.

  • The driver does not throw a runtime error when you unmarshal an empty bson.RawValue type with an invalid type or marshal a nil pointer of a ReadConcern instance.

  • Setting options.LogComponentAll as the log component correctly results in the publication of logs against all components.

Important

Deprecation Notice

  • The mongo.NewClient() and client.Connect() methods are deprecated. You can create a client and connect in one call by using the mongo.Connect() method.

New features of the 1.12 Go driver release include:

This driver version adds support for Queryable Encryption (QE). To learn more about the requirements for using the QE feature, see the Queryable Encryption Driver Compatibility Table.

The ClientEncryption.CreateEncryptedCollection() method automatically creates data encryption keys when you create a new encrypted collection. To learn how to use the QE feature, see the Quick Start in the Server manual.

You can now record connection management and command execution events by using the LogSink logging interface.

To learn more, see the Logging Fundamentals guide.

This driver version adds features to the options package to specify how the driver marshals and unmarshals BSON.

The following example shows how to set BSON options on your Client. The options specify the following behaviors:

  • The driver falls back to json struct tags if bson struct tags are absent.

  • The driver marshals nil Go map types as empty BSON documents.

  • The driver marshals nil Go slice types as empty BSON arrays.

bsonOpts := &options.BSONOptions{
UseJSONStructTags: true,
NilMapAsEmpty: true,
NilSliceAsEmpty: true,
}
options.Client().SetBSONOptions(bsonOpts)

For a full example of how to specify and implement the BSONOptions type, see the API documentation.

This driver version simplifies the WriteConcern API. To learn more about the changes, see Write Concern.

  • Support for authentication with AWS IAM roles in EKS.

  • Addition of the Cursor.SetBatchSize() method to allow specification of the size of batches fetched when iterating through a cursor.

  • Addition of the UnmarshalValue() method to allow ummarshalling of BSON values marshalled with the MarshalValue() method.

Back

Quick Reference