[ANN] mgo r2012.09.05

204 views
Skip to first unread message

Gustavo Niemeyer

unread,
Sep 5, 2012, 8:54:57 AM9/5/12
to golan...@googlegroups.com, mongod...@googlegroups.com, mgo-...@googlegroups.com
Greetings,

A new release of the mgo MongoDB driver for Go is out with
a few MongoDB 2.2 supporting features and a new feature
in the experimental transaction package.

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

http://labix.org/mgo


The following changes were made in this release:

- The new aggregation framework was nealty integrated with
an interface resembling the existing querying mechanisms.
For example:

pipeline := []bson.M{{"$match": bson.M{"name": "Otavio"}}}
pipe := collection.Pipe(pipeline)

The resulting pipe value has familiar methods, such as
Iter, All, and One. See the documentation for details:

http://labix.org/v2/mgo#Collection.Pipe
http://labix.org/v2/mgo#Pipe.Iter
http://labix.org/v2/mgo#Pipe.All
http://labix.org/v2/mgo#Pipe.One

Documentation on the new aggregation feature of MongoDB:

http://docs.mongodb.org/manual/applications/aggregation


- The Index type has a new ExpireAfter field to enable the
use of TTL collections. For example:

index := mgo.Index{
Key: []string{"time"},
ExpireAfter: 5 * time.Minute,
}
err := collection.EnsureIndex(index)

For more details see the documentation:

http://labix.org/v2/mgo#Collection.EnsureIndex
http://labix.org/v2/mgo#Index

For details on TTL collections:

http://docs.mongodb.org/manual/tutorial/expire-data


- New Runner.ChangeLog method in the exprimental mgo/txn
package enables recording all changes applied via
transactions into a collection:

http://labix.org/v2/mgo/txn#Runner.ChangeLog


gustavo @ http://niemeyer.net

Nigel Vickers

unread,
Sep 5, 2012, 10:11:11 AM9/5/12
to mgo-...@googlegroups.com
Hallo Gustavo ,

On 5 September 2012 14:54, Gustavo Niemeyer <gus...@niemeyer.net> wrote:
> Greetings,
>
> A new release of the mgo MongoDB driver for Go is out with
> a few MongoDB 2.2 supporting features and a new feature
> in the experimental transaction package.

Feeling very impressed and envious. I always wanted to be able to
abstract like you. Probably too old to learn. Thank you for your
efforts. They are much appreciated.



> gustavo @ http://niemeyer.net

yours aye, Nigel Vickers

Gustavo Niemeyer

unread,
Sep 5, 2012, 12:51:52 PM9/5/12
to mgo-...@googlegroups.com
On Wed, Sep 5, 2012 at 11:11 AM, Nigel Vickers <rhe...@gmail.com> wrote:
> Hallo Gustavo ,
>
> On 5 September 2012 14:54, Gustavo Niemeyer <gus...@niemeyer.net> wrote:
>> Greetings,
>>
>> A new release of the mgo MongoDB driver for Go is out with
>> a few MongoDB 2.2 supporting features and a new feature
>> in the experimental transaction package.
>
> Feeling very impressed and envious. I always wanted to be able to
> abstract like you. Probably too old to learn. Thank you for your
> efforts. They are much appreciated.

That's very kind, Nigel. Thank you. I actually bet you're not too old
for that. It's mainly about trying to get it right, while repeatedly
getting it wrong. The mgo interface changed quite a bit since
originally created, and the main mistakes were fixed along the way
while using it.


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