A major new release of the mgo MongoDB driver for Go is out, including the following enhancements and fixes:
Decimal128 support
Introduces the new bson.Decimal128 type, upcoming in MongoDB 3.4 and already available in the 3.3 development releases.
Extended JSON support
Introduces support for marshaling and unmarshaling MongoDB’s extended JSON specification, which extend the syntax of JSON to include support for other BSON types and also allow for extensions such as unquoted map keys and trailing commas.
The new functionality is available via the bson.MarshalJSON and bson.UnmarshalJSON functions.
New Iter.Done method
The new Iter.Done method allows querying whether an iterator is completely done or there’s some likelyhood of more items being returned on the next call to Iter.Next.
Feature implemented by Evan Broder.
Retry on Upsert key-dup errors
Curiously, as documented the server can actually report a key conflict error on upserts. The driver will now retry a number of times on these situations.
Fix submitted by Christian Muirhead.
Switched test suite to daemontools
Support for supervisord has been removed and replaced by daemontools, as the latter is easier to support across environments.
Travis CI support
All pull requests and master branch changes now being tested on several server releases.
Initial collation support in indexes
Support for collation is being widely introduced in 3.4 release, with experimental support already visible in 3.3.
This releases introduces the Index.Collation field which may be set to a mgo.Collation value.
Removed unnecessary unmarshal when running commands
Code which marshaled the command result for debugging purposes was being run out of debug mode. This has been fixed.
Reported by John Morales.
Fixed Secondary mode over mongos
Secondary mode wasn’t behaving properly when connecting to the cluster over a mongos. This has been fixed.
Reported by Gabriel Russell.
Fixed BuildInfo.VersionAtLeast
The VersionAtLeast comparison was broken when comparing certain strings. Logic was fixed and properly tested.
Reported by John Morales.
Fixed unmarshaling of ,inline structs on 1.6
Go 1.6 changed the behavior on unexported anonymous structs.
Livio Soares submitted a fix addressing that.
Fixed Apply on results containing errmsg
The Apply method was confusing a resulting object containing an errmsg field as an actual error.
Reported by Moshe Revah.
Improved documentation
Several contributions on documentation improvements and fixes.