I am trying to connect my java code with mongodb locally hosted. Using dependencies - jUnit v3.8.1 and mongodb-driver-sync v3.11.0. But getting a error while establishing the connection using method "MongoClient" undefined method.
Tried creating a new method for "MongoClient" but there is nothing to create over there.
public static void main(String[] args) {
MongoClient mongoClient = MongoClient("127.0.0.1", 27017);
MongoDatabase database = mongoClient.getDatabase("test");
}
The expection is to setup the connection locally between the java code and MongoDB on ("127.0.0.1", 27017) and to perform CRUD method.