Reputation: 5719
I use MongoDB driver 3.4.1 an I will set this URL
url = "mongodb://username:password@serverName:27017/databaseName?authMechanism=SCRAM-SHA-1&ssl=true";
with
MongoClientOptions.Builder builder = MongoClientOptions.builder();
but I don't know how to set
authMechanism=SCRAM-SHA-1&ssl=true";
this one with MongoClientOptions?
Upvotes: 0
Views: 316
Reputation: 2453
From the documentation
With a static factory method:
MongoCredential credential = MongoCredential.createScramSha1Credential(user,
database,
password);
Or in the connection string:
MongoClientURI uri = new MongoClientURI("mongodb://user1:pwd1@host1/?authSource=db1&authMechanism=SCRAM-SHA-1");
Upvotes: 1