I’m using this MongoDB driver for Lucee:
I’m able to authenticate with only user “admin”.
If I use the java driver directly (MongoClient), with the same connection string that I enter in MongoDBConnect(), it works.
connectionString = "mongodb://myuser:myPasSw0rd@myhost:27017";
works:
var Mongo = CreateObject( "java", "com.mongodb.MongoClient" ).init( connectionString );
not works:
var Mongo = MongoDBConnect( "mydb", connectionString );
this is the complete error:
Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}.
Client view of cluster state is {type=UNKNOWN, servers=[{address=node223905-my-host:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName=‘useraccount’, source=‘admin’, password=, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: ‘Authentication failed.’ on server node223905-env-4613860.j.layershift.co.uk:27017. The full response is { “ok” : 0.0, “errmsg” : “Authentication failed.”, “code” : 18, “codeName” : “AuthenticationFailed” }}}]
Any suggestions are appreciated
OS: Windows/Linux
Java Version: 1.8.0_221
Tomcat Version: 8.5.43
Lucee Version: 5.3.4.80