Search code examples
mongodbauthenticationmongodb-javamongo-javamongo-java-driver

How can I authenticate any database with given username and password in Mongo Java Driver 2.13.0?


Previously I could use db.authenticate(String username, char[] password) method. With 2.13.0, how can I achieve this?


Solution

  • There is no replacement for db.authenticate(). The driver will use the credentials provided and make sure the connections are authenticated as they are created.

    Based on this mongodb-user discussion the Java Driver team is open to discussions on what the real need for the db.authenticate(...) method.