grails/grails-data-mapping — pull request #27 by jsaardchit (2014-06-11 22:37:55+00:00)
Title: Fix mongo authentication for for applications with no mapped Domain Classes

In new mongo plugin, the only time username, password, databaseName (from config) are used to authenticate are when Domain Class templates are created. If an application does not have mongo mapped domain classes, using the spring inject "mongo" bean throws authentication failures even when specifying credentials.

Caveat: When using the connectionString property and specifying credentials (mongodb://user:pass@host:port/db), the authentication is left to the GMongo/MongoClient constructor which allows the use case to pass. However, forcing this would cause a lot config file rewrites for a lot of applications that we currently have in use.

If you guys would like to handle differently, by all means. I'm just providing a quick solution as speed is of the essence for us in this regard. Thanks!