A maintenance release of the mgo MongoDB driver for Go is out with
fixes and minor features.
Details about the driver may be found in its web page:
http://labix.org/mgo
The following changes were made in this release:
- Sessions on Monotonic mode now behave properly when a write during
an iteration forces a shift from slave to master while further items
from the iteration are still wanted. Thanks to Mikael Gustavsson for
the bug report.
- Fixed query.Batch(1) behavior to workaround the server-defined
semantics of closing the cursor on such requests. Iterations now
work properly with it. Thanks to Roger Peppe and Aram Hăvărneanu
for the bug report.
- Types implementing bson.Setter can now return bson.SetZero to
preserve a field zeroed. This enables keeping pointers nil when the
type implementing the setter interface is a field of an outter type
being unmarshalled.
- New mgo.IsDup(err) method enables convenient verification of whether
an error was caused by a duplicate entry violating a unique index in
the database.
Besides being handy, this enables dealing with the inconsistency
caused by the server issue
https://jira.mongodb.org/browse/SERVER-7164,
which causes capped collections and non-capped collections to report
different errors on such situations. IsDup handles both cases
evenly.
gustavo @
http://niemeyer.net