Here is the old code:
String uri = "mongodb://" + dbUser + ":" + dbPass + "@" + servers + "/"+dbName+ "?ssl=true&authSource=admin&connectTimeoutMS=6000&socketTimeoutMS=6000";
MongoClientURI uriObj = new MongoClientURI(uri);
MongoClient client = new MongoClient(uriObj);
DB db = client.getDB(dbName); ==> deprecated
Since MongoClient.getDB(dbName) is deprecated, here is the new code:
String uri = "mongodb://" + dbUser + ":" + dbPass + "@" + servers + "/"+dbName+ "?ssl=true&authSource=admin&connectTimeoutMS=6000&socketTimeoutMS=6000";
MongoClientURI uriObj = new MongoClientURI(uri);
MongoClient client = new MongoClient(uriObj);
MongoDatabase database = client.getDatabase(dbName); ==> How to get DB db?
How to get a DB object (as DB db in the old code) from the new code?