@Test(enabled = false) public void testConnect() throws NumberFormatException, UnknownHostException { MongoClient mc = MongoConnector.createClient(); DB db = mc.getDB("lcdocs"); DBCollection collection = db.getCollection("statements.files"); DBCursor cursor = collection.find(new BasicDBObject("filename", Pattern.compile("/.*278174.*/"))); while (cursor.hasNext()) { collection.remove(cursor.next()); } }
public static MongoClient createClient() throws NumberFormatException, UnknownHostException { if (!clients.containsKey(database)) { validateConfig(database); MongoCredential credential = MongoCredential.createMongoCRCredential(user, database, password.toCharArray()); clients.put(database, new MongoClient(new ServerAddress(host, Integer.valueOf(port)), Arrays.asList(credential))); } return clients.get(database); }
MongoConnector { public static MongoClient createClient() throws NumberFormatException, UnknownHostException { if (!clients.containsKey(database)) { validateConfig(database); MongoCredential credential = MongoCredential.createMongoCRCredential(user, database, password.toCharArray()); clients.put(database, new MongoClient(new ServerAddress(host, Integer.valueOf(port)), Arrays.asList(credential))); } return clients.get(database); } }
MongoConnector { public static MongoClient createClient() throws NumberFormatException, UnknownHostException { if (!clients.containsKey(database)) { validateConfig(database); MongoCredential credential = MongoCredential.createMongoCRCredential(user, database, password.toCharArray()); clients.put(database, new MongoClient(new ServerAddress(host, Integer.valueOf(port)), Arrays.asList(credential))); } return clients.get(database); }  }
MongoConnector { public static MongoClient createClient() throws NumberFormatException, UnknownHostException { if (!clients.containsKey(database)) { validateConfig(database); MongoCredential credential = MongoCredential.createMongoCRCredential(user, database, password.toCharArray()); clients.put(database, new MongoClient(new ServerAddress(host, Integer.valueOf(port)), Arrays.asList(credential))); } return clients.get(database); }  static MongoClient createClient(); static MongoClient createClient(String database); static String getHost(); static void setHost(String host); static String getPort(); static void setPort(String port); static String getUser(); static void setUser(String user); static String getPassword(); static void setPassword(String password); static String getDatabase(); static void setDatabase(String database); }
MongoConnector { public static MongoClient createClient() throws NumberFormatException, UnknownHostException { if (!clients.containsKey(database)) { validateConfig(database); MongoCredential credential = MongoCredential.createMongoCRCredential(user, database, password.toCharArray()); clients.put(database, new MongoClient(new ServerAddress(host, Integer.valueOf(port)), Arrays.asList(credential))); } return clients.get(database); }  static MongoClient createClient(); static MongoClient createClient(String database); static String getHost(); static void setHost(String host); static String getPort(); static void setPort(String port); static String getUser(); static void setUser(String user); static String getPassword(); static void setPassword(String password); static String getDatabase(); static void setDatabase(String database);  }