MongoDB Go Driver 1.4.0
The MongoDB Go driver team is pleased to release 1.4.0 of the official Go driver.
This release contains support for the MongoDB 4.4 server features, as well as multiple driver-specific improvements.
Documentation 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 Jira where a list of current issues can be found.
OCSP
This release includes support for both stapled and non-stapled OCSP verification. The driver will perform OCSP verification on all stapled responses and will also reach out to OCSP responders via HTTP requests if any are present in the server’s TLS certificate and there is no OCSP response. The driver does soft-fail verification, so a connection is rejected if and only if the certificate’s OCSP status is Revoked. If the driver is unable to retrieve a response or the response status is Unknown, the connection will be accepted.
URI Options
By default, the driver will send HTTP requests to OCSP responders if there is no stapled response. If the responder is not reachable from the driver and this would add unnecessary latency to an application, the tlsDisableOCSPEndpointCheck=true
URI option may be used to disable this. In this case, the driver will perform OCSP verification for stapled responses if they exist and will continue the connection without further verification otherwise.
BSON Decoding Errors
This release adds context to errors encountered during BSON unmarshalling. For example, if the document {x: {y: {z: 1}}}
was unmarshalled into a struct where field Z
is a string, the driver would return this error: error decoding key x.y.z: cannot decode 32-bit integer into a string type
.
Proper Unwrapping for Errors
Go 1.13 introduced the errors.Is
and errors.As
helpers. This release adds proper Unwrap
functions to various driver error types, which allow them to be used with the language helpers. For example, context-related timeout errors can now be accurately checked with errors.Is(err, context.DeadlineExceeded)
.
Release Notes
For a full list of tickets included in this release, please see the links below: