Here is a list of changes in this release:
- GridFS support! Now mgo can be used to send and receive
files to MongoDB using the standard GridFS specification
for file storage. This means that it may share the same
database collections used for file storage with drivers
for other languages, and also the command line tools
provided with MongoDB itself (e.g. mongofiles).
In addition to a selection of relevant methods, the
*mgo.GridFSFile type implements support for both io.Reader
and io.Writer interfaces, which means it integrates
nicely with the standard library.
Here is a simple example storing a file of arbitrary size
into the database:
file, err := db.GridFS("fs").Create("myfile.txt")
check(err)
iso, err := os.Open("cd.iso")
check(err)
defer iso.Close()
err = ioutil.Copy(file, iso)
check(err)
err = file.Close()
check(err)
Some entry points to relevant documentation:
http://goneat.org/lp/mgo#Database.GridFS
http://goneat.org/lp/mgo#GridFS.Create
http://goneat.org/lp/mgo#GridFS.Open
http://goneat.org/lp/mgo#GridFS.OpenId
- gobson got improved handling of pointers to basic types
so that it's easier to manage types which are unset.
- Fixed conditional support ("/c") for pointers in gobson.
--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/blog
http://niemeyer.net/twitter
> I'm assuming, though, that check(err) is just a stand-in for actual
> error handling.
Yes, do the proper error checking for your own use please. The
intention was to drive attention to the actual logic rather than the
error checking, but apparently it didn't work.