I am new to MongoDB and I want to establish connection with my mongod server. But I get the error MongoClient cannot be resolved to a type
I have included external Jar into my project but still cannot fix the error
Here is my code I think there is no error in my code but I have included wrong JAR file in my project
import com.mongodb.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
public class Dining {
public static void main[String[] args] {
Lock forks[] = new ReentrantLock[5];
try {
MongoClient mongoClient = new MongoClient["mongo"];
System.out.println["Connection to mongodb successful."];
DB db = mongoClient.getDB[ "mydb" ];
System.out.println["Database 'mydb' created."];
DBCollection coll = db.createCollection["mycol", null];
System.out.println["Collection 'mycol' created."];
} catch [Exception e] {
// TODO Auto-generated catch block
e.printStackTrace[];
}
for[int i = 0; i