Reputation: 623
Using mongodb in grails i am trying to get a hold of the database from a service in the same fashion as when connecting to it from a controller.
e.g
static mongo
def db = mongo.getDB("dbone")
this does not seem to work. Is there a way to get a hold of the database from within a service in some other fasion?
Upvotes: 0
Views: 237
Reputation: 7985
You're using a 'static' variable which is incorrect. Try 'def mongo'
Upvotes: 2