github mongodb/mongo-go-driver v1.7.0
MongoDB Go Driver 1.7.0

latest releases: v1.14.1, v1.13.4, v1.13.3...
2 years ago

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

This release supports additional features introduced in MongoDB version 5.0.

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.

Snapshot Reads Without Transaction

Supports using the "snapshot" read concern outside of transactions for certain operations.

Example of using a Session with "snapshot" read concern outside of a transaction for a Find operation:

var client *mongo.Client

// Create a new Session with "snapshot" reads enabled, then create a
// SessionContext with the new Session.
sess, err := client.StartSession(options.Session().SetSnapshot(true))
if err != nil {
	panic(err)
}
defer sess.EndSession(context.TODO())
sessCtx := mongo.NewSessionContext(context.TODO(), sess)

coll := client.Database("db").Collection("coll")
cursor, err := coll.Find(sessCtx, bson.D{{"x", 1}})
defer cursor.Close(context.TODO())

// Use the cursor to read Find results with "snapshot" read concern.

Detailed Document Validation Errors

Surface the improved error messages for schema validation in MongoDB 5.0 in WriteException and BulkWriteException error messages and via the new field WriteError.Details.

Release Notes

For a full list of tickets included in this release, please see the links below:

Don't miss a new mongo-go-driver release

NewReleases is sending notifications on new releases.