Use createCredential so that authentication will work with both 2.x and 3.x MongoDB servers
This commit is contained in:
parent
392b1f1e17
commit
7be0b1c9f5
1 changed files with 1 additions and 1 deletions
|
@ -239,7 +239,7 @@ public class DefaultMongoConnectionFactoryProvider implements MongoConnectionPro
|
|||
|
||||
MongoClient client;
|
||||
if (user != null && password != null) {
|
||||
MongoCredential credential = MongoCredential.createMongoCRCredential(user, dbName, password.toCharArray());
|
||||
MongoCredential credential = MongoCredential.createCredential(user, dbName, password.toCharArray());
|
||||
client = new MongoClient(new ServerAddress(host, port), Collections.singletonList(credential), clientOptions);
|
||||
} else {
|
||||
client = new MongoClient(new ServerAddress(host, port), clientOptions);
|
||||
|
|
Loading…
Reference in a new issue