Following the release r59 of Go, another quick update on the
mgo MongoDB driver for Go is available, including compatibility
fixes and a few additional goods.
The project page with details is available at:
The following changes were made in release r2011.08.02.
- The tag format for marshalled fields has been changed to
follow the conventions established in release r59 of Go.
The key name within the tag is now separated from flags
using a comma, and flags have also been renamed.
Here is a simple table for migration:
"/c" => ",omitempty"
"/s" => ",minsize"
"/cs" => ",omitempty,minsize"
"key" => "key"
"key/c" => "key,omitempty"
"key/s" => "key,minsize"
"key/cs" => "key,omitempty,minsize"
If provided with an old-styled tag, gobson will panic
reporting the problem and will also inform the new
spelling for the specific tag at hand.
For more details, please see the documentation:
- The bson tag information can now be namespaced. For
example, the following is a valid tag with information for
both the json and the bson packages:
Using the bson namespace is optional as long as the
content of the tag, which should be fully oriented towards
gobson, does not contain the ":" character.
- To improve consistency in the naming convention, the recently
introduced GetRef methods have been renamed to FindRef, and
GetLiveServers was renamed to LiveServers:
- New ObjectId.Hex method to obtain the commonly wanted hex
representation of the id, as requested by Travis Reeder:
- ObjectId pointers may now be marshalled and unmarshalled
properly by the json package, also requested by Travis:
- New DatabaseNames and CollectionNames methods, as requested
by Fabian Reinartz:
- New GridFile.UploadDate method, also requested by Fabian:
-- I never filed a patent.