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")
iso, err := os.Open("cd.iso")
err = ioutil.Copy(file, iso)
err = file.Close()
Some entry points to relevant documentation:
- 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.
> 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.