[ANN] mgo and gobson r2011.04.28

33 views
Skip to first unread message

Gustavo Niemeyer

unread,
Apr 28, 2011, 10:29:55 PM4/28/11
to golang-nuts, mongod...@googlegroups.com, mgo-...@googlegroups.com
The r2011.04.28 release of the mgo MongoDB driver for Go is just
leaving the presses:

http://labix.org/mgo

Here is a list of changes in this release:

- mgo and gobson were ported to the weekly.2011-04-27 release of Go.

- The Iter.For and Query.For methods will now return err == nil when
they iterate successfully up to the last available result, rather
than mgo.NotFound.

- New Explain and Hint methods for query optimization:

http://goneat.org/lp/mgo#Query.Explain
http://goneat.org/lp/mgo#Query.Hint

- GridFS support will now ensure an index exists on {"files_id", "n"}
when the first file is created.

- The new GridFSFile type was renamed to GridFile.

- Other minor renamings continuing the consitency improvements:

mgo.CollectStats(true) => mgo.SetStats(true)
mgo.Debug(true) => mgo.SetDebug(true)

- In addition to byte slices, gobson can now marshal and
unmarshal byte arrays as binary BSON data.


--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/blog
http://niemeyer.net/twitter

Leon Szpilewski

unread,
Apr 29, 2011, 3:59:41 AM4/29/11
to mgo-...@googlegroups.com, golang-nuts, mongod...@googlegroups.com
Great work, Gustavo!

One little question regarding:

- The Iter.For and Query.For methods will now return err == nil when
>  they iterate successfully up to the last available result, rather
>  than mgo.NotFound.


Im using Iter.Next in a for{} loop like in the example here:

> for {
>   err := iter.Next(&smthg)
>   if err != nil { break; }
> }

Does this change mean that the "while(1)" loop won't be exited anymore?
Just asking before I induce infinite loops into my code :)

regards,
Leon

Gustavo Niemeyer

unread,
Apr 29, 2011, 8:30:22 AM4/29/11
to mgo-...@googlegroups.com, golang-nuts, mongod...@googlegroups.com
Hi Leon,

> Great work, Gustavo!

Thanks!

>> - The Iter.For and Query.For methods will now return err == nil when
>>  they iterate successfully up to the last available result, rather
>>  than mgo.NotFound.
>
> Im using Iter.Next in a for{} loop like in the example here:

Nothing changed there. What changed was specifically the For
methods, because it's strange to have a non-nil error when they
did exactly what was requested.

Reply all
Reply to author
Forward
0 new messages