revmgo
mgo module for revel framework
Module Use
app.conf
Settings can be configured via the following directives in app.conf.
modules.mgo
module.mgo=github.com/Tsuguya/revmgo
Please review the documentation at Revel - Modules - Overview for more information
mgo.host
Please review the documentation at mgo.Session.Dial() for information on the syntax and valid settings.
mgo.method
This can be one of 'clone', 'copy', 'new'. See mgo.Session.New() for more information.
mgo.database
The name of the default database you want to use
Embedding the controller
In any controller you want to have mongo connectivity you must include the
MongoController.
Add the following import line in source files that will embed MongoController.
"github.com/Tsuguya/revmgo/app"
Embed the MongoController on your custom controller;
type Application struct {
*revel.Controller
revmgo.MongoController
// Other fields
}
Your controller will now have a MongoSession variable of type *mgo.Session and a Database variable of type *mgo.Database. Use this
to query your mongo datastore.
Running sample
revel run github.com/Tsuguya/revmgo/sample
See Also
