Robert
Robert

Reputation: 180

Grails 3.0.1 not honoring application.yml mongo config

Trying to start Grails 3.0.1 app using only mongodb. The mongo plugin does not seem to be reading the mongo config in the application.yml file. I've putting it in the environments development section, outside the environments section, etc. but it just uses default config of localhost:27017 and db name of 'test'.

here is the current config:

// default application.yml stuff
environments:
  development:
   grails:
      mongo:
         host: 'ip_address_here'
         port: 27017
         databaseName: 'app_dev'
   test:
// rest of application.yml stuff

As a test, in the BootStrap I dumped out the grailsApplication.config data and the mongo stuff does appear there, so it is getting loaded.

Upvotes: 3

Views: 1136

Answers (3)

Mexx
Mexx

Reputation: 359

Documentation might be little confusing, this should do the trick with auth

 connectionString: "mongodb://myUserName:myPassword@ipOfServer:portOfServer/dbName"

Upvotes: 0

whitespy9
whitespy9

Reputation: 148

Here is the configuration that works for me with

Grails 3.0.1 org.grails.plugins:mongodb:4.0.0

environments:
    development:
        grails:
            mongodb:
                connectionString: "mongodb://127.0.0.1/test"
                autoConnectRetry: true
                connectTimeout: 0
                maxWaitTime: 120000
                socketTimeout: 0
                socketKeepAlive: false
                writeNumer: 0
                writeTimeout: 0
                writeFsync: false
        dataSource:
            dbCreate: create-drop

Upvotes: 3

Vladislav Eliseev
Vladislav Eliseev

Reputation: 46

Look here for all configuration options. Note especially "mongodb" instead of just "mongo"

Upvotes: 2

Related Questions