[ANN] mgo r2012.08.23

83 views
Skip to first unread message

Gustavo Niemeyer

unread,
Aug 23, 2012, 9:42:21 PM8/23/12
to golan...@googlegroups.com, mongod...@googlegroups.com, mgo-...@googlegroups.com
A quick new release of the mgo MongoDB driver for Go is out,
this time including polishings for the experimental txn package,
and also other relevant improvements in mgo and bson.

Details about the driver may be found in its web page:

http://labix.org/mgo

And the blog post on the transaction package was tweaked to
reflect the trivial API changes:

http://blog.labix.org/2012/08/22/multi-doc-transactions-for-mongodb

The following changes were made in this release:

- A few polishings in the experimental mgo/txn package:

- The API was superficially tweaked (field names, etc)
- The info field is now properly saved
- Insert and Update documents now preserve the field order
- Run will now validate the operations
- Documentation fixes and improvements

- The bson package was improved so that it is now possible to
retrieve an entirely ordered document, including nested
sub-documents. This may be achieved with familiar logic:

var doc bson.D
err := collection.Find(query).One(&doc)

Any sub-documents within the retrieved document will also have
the bson.D type. The change also enables the use of custom
types based on []DocElem with the same semantics.

- The same fix was made for map types: if a custom map type is
defined and used, as in:

type MyMap map[string]interface{}
var mymap MyMap
err := collection.Find(query).One(&mymap)

Any sub-documents within mymap will also have the MyMap type.

- It is now possible to lookup the database provided in the Dial
URL by using:

db := session.DB("")

If no database was provided in the URL, the "test" database
will be returned, in a way equivalent to the mongo shell.

More details:

http://labix.org/v2/mgo#Session.DB
http://labix.org/v2/mgo#Dial


gustavo @ http://niemeyer.net
Reply all
Reply to author
Forward
0 new messages