[ANN] mgo 2012.02.02

Skip to first unread message

Gustavo Niemeyer

Feb 2, 2012, 6:00:11 PM2/2/12
to golang-nuts, mongod...@googlegroups.com, mgo-...@googlegroups.com
Another release of the mgo MongoDB driver for Go is out.

Most notably, this release brings a few incompatible improvements
in the mgo/bson package that brings it up-to-date with the upcoming
Go 1 release. One of the incompatible changes must be handled a
bit more carefully, so please read on.

The release also includes some nice improvements in the replica set
synchronization logic, so depending on your setup it may be worth
upgrading to it sooner.

It may be a bit early to say so, but there's a good chance that the
incompatible changes are over for the time being. The release is
compatible with the Go weekly release 2012-01-20 onwards.

Project details are available at:


The following changes were made in this release:

- The discovery and synchronization of servers was improved to
  handle better situations such as when servers are purposefully
  added or removed from a replica set while the application is

  Thanks to Kyle Banker for clearly describing an edge case due to
  which drivers can easily misbehave.

- Getter.GetBSON method must now return an error value. If the error
  is not nil, the marshalling procedure is stopped and the error is
  returned back to the caller.

  This is the most sensitive change in this release. If you have
  values with custom bson marshalling logic, please double check
  your code for this change since it will continue to compile fine,
  but will misbehave if not updated.


- The bson.Timestamp type is gone, and full support for time.Time
  has been added. Use time.Time for marshalling and unmarshalling
  bson timestamp fields.

  The bson.Now function continues to exist, but will now return a
  time.Time that has its precision reduced to milliseconds, so that
  a roundtrip to the database will not alter the time value.
  Using time.Now works fine too, but roundstrips to the database
  will truncate the value.


- NewObjectIdSeconds was renamed NewObjectIdWithTime, and now takes
  a time.Time as argument:


- The ObjectId.Timestamp method was renamed ObjectId.Time and now
  returns a time.Time:


- GridFile.UploadDate now returns a time.Time:


- bson.JS was renamed JavaScript.


- Documentation improvements. Thanks to Fabian Reinartz for pointing
  out a missing change in the previous release

Gustavo Niemeyer

-- I'm not absolutely sure of anything.

Mikhail Strebkov

Feb 4, 2012, 5:14:43 AM2/4/12
to golan...@googlegroups.com, mongod...@googlegroups.com, mgo-...@googlegroups.com
The bson.Timestamp type is gone, and full support for time.Time has been added.
Good news for me. Thanks for that change! 

marten luter

Jul 3, 2012, 4:05:32 PM7/3/12
to mgo-...@googlegroups.com, golang-nuts, mongod...@googlegroups.com
Hi gustavo,
i cand understand how $or request look like . i have tryet all combinations bson.M , bson.D but without success 
the last one was 

iter := MongoItems.Find(bson.M{
"$or" : bson.D{{

Gustavo Niemeyer

Jul 3, 2012, 5:36:52 PM7/3/12
to ent...@googlemail.com, mgo-...@googlegroups.com, golang-nuts, mongod...@googlegroups.com
Hey Marten,

On Tue, Jul 3, 2012 at 5:05 PM, marten luter <ent...@googlemail.com> wrote:
> i cand understand how $or request look like . i have tryet all combinations
> bson.M , bson.D but without success
> the last one was

This message from Jordan Orelli in the mgo-users mailing list will be helpful:


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