Here is a summary of changes:
- Authentication support, with great connection pooling integration.
This enables mgo to talk to protected servers and replica sets in a very
comfortable way. Even with a straightforward API, the authentication
is internally cached in a secure way to avoid constant roundtrips to the
database. The use of nonces is also optimized so that logins are usually
performed with a single roundtrip to the database.
For more details, check the relevant API documentation:
http://goneat.org/lp/mgo/#Database.AddUser
http://goneat.org/lp/mgo/#Database.RemoveUser
http://goneat.org/lp/mgo/#Database.Login
http://goneat.org/lp/mgo/#Database.Logout
http://goneat.org/lp/mgo/#Session.LogoutAll
http://goneat.org/lp/mgo/#Session.Copy
- Authentication is also supported through the URL provided to the Mongo
function, in the same way supported by the official drivers from 10gen:
http://goneat.org/lp/mgo/#Session.Mongo
- Several new methods to better support the MongoDB API:
http://goneat.org/lp/mgo/#Collection.Count
http://goneat.org/lp/mgo/#Query.Count
http://goneat.org/lp/mgo/#Query.Limit
http://goneat.org/lp/mgo/#Session.Ping
http://goneat.org/lp/mgo/#Session.Copy
- New gobson functions for generating ObjectIds, by Dmitry Chestnykh:
http://goneat.org/lp/gobson/bson/#ObjectId.NewObjectId
http://goneat.org/lp/gobson/bson/#ObjectId.NewObjectIdSeconds
- New gobson function for working with hex ObjectId representations, also
by Dmitry Chestnykh:
http://goneat.org/lp/gobson/bson/#ObjectId.ObjectIdHex
http://goneat.org/lp/gobson/bson/#ObjectId.String
- New *mgo.QueryError type is returned by Query.One and Iter.Next in the
err value in case the resulting document includes the $err key. This
is a common convention used by MongoDB in case of query errors, and
the new behavior integrates well with the common Go conventions for
error handling.
Relevant documentation:
http://goneat.org/lp/mgo/#Query.One
http://goneat.org/lp/mgo/#Iter.Next
http://goneat.org/lp/mgo/#QueryError
- The Session.Restart method was renamed to Session.Refresh to better
reflect its meaning. The semantics remain the same:
http://goneat.org/lp/mgo/#Session.Refresh
- Improved documentation.
- 30+ new test cases.
--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/blog
http://niemeyer.net/twitter