MyGit

v1.6.0

mongodb/mongo-go-driver

版本发布时间: 2021-07-14 00:30:46

mongodb/mongo-go-driver最新发布版本:v1.15.0(2024-04-17 01:44:15)

:warning: Retracted

This release has been retracted due to a data race that can occur between creating and checking out connections when minPoolSize > 0.

Please use version 1.6.2 or higher.


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

This release supports several new features introduced in MongoDB server 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.

Versioned API

This release adds versioned API: a new feature in MongoDB 5.0 that allows user-selectable API versions, subsets of MongoDB server semantics, to be declared on a Client with ServerAPIOptions. See an explanatory blog post here.

ServerAPIOptions can be declared on a Client in the Go driver with SetServerAPIOptions. Within a ServerAPIOptions instance, ServerAPIVersion specifies the declared API version, Strict specifies whether the server should error when it receives a command that is not part of the declared API version, and DeprecationErrors specifies whether the server should error when it receives a command that is deprecated in the declared API version.

Load Balancer Support

The Go driver now supports connecting to any MongoDB service (such as MongoDB Serverless) that is running behind a load balancer.

ClientOptions contains a new LoadBalanced flag that can be set with SetLoadBalanced or by passing loadBalanced=true into the initial URI string.

Time-series Collections

This release allows the creation of time-series collections: a new collection type that will automatically organize time-series data into buckets on insert, while automatically unwinding the buckets for query purposes.

CreateCollectionOptions contains a new TimeSeriesOptions field that can be set with SetTimeSeries. The fields of TimeSeriesOptions are defined as follows. TimeField specifies the name of the top-level field that will represent the timestamp in the collection's documents. MetaField can specify the name of the top-level field that will describe the series in the collection's documents. Granularity can specify the desired granularity of the time-series data (at present, this value can be "seconds", "minutes" or "hours").

CreateCollectionsOptions also contains a new ExpireAfterSeconds field that can be set with SetExpireAfterSeconds. ExpireAfterSeconds can specify how many seconds to wait before old time-series data should be deleted from the time-series collection.

Let Option on Aggregate

Let can now be specified on aggregates. See an explanation and examples of the let option in the aggregate documentation.

AggregateOptions contains a new Let field that can be set with SetLet.

Release Notes

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

相关地址:原始地址 下载(tar) 下载(zip)

查看:2021-07-14发行的版本