Tip error: Com.mongodb.MongoQueryException:Query failed with error code and error messages ' not authorized for Query '
Reference URL: http://stackoverflow.com/questions/31503525/unable-to-connect-to-remote-mongo-db-for-2-days
mongo2.6 Configure user authentication, just focus on the following Red font section
<mongo:mongo-client id= "mongoclient" replica-set= "#{mongo[servers]}" credentials= "Dbuser:dbpass@dbname}" >
<mongo:client-options
Connections-per-host= "#{mongo[connections_per_host]}"
Threads-allowed-to-block-for-connection-multiplier= "5"
Connect-timeout= "#{mongo[connection_timeout]}"
Max-wait-time= "#{mongo[max_wait_time]}"
Socket-keep-alive= "#{mongo[socket_keepalive]}"
Socket-timeout= "#{mongo[socket_timeout]}"
Write-concern= "#{mongo[write_concern]}"/>
</mongo:mongo-client>
<mongo:db-factory dbname= "#{mongo[db_name]}" mongo-ref= "Mongoclient"/>