package com.shoppertrak.thresher; import java.util.Arrays; import com.mongodb.Mongo; import com.mongodb.ServerAddress; public class TestMongo { public static void main(String[] args) { try { //tunnels to another mongo instance Mongo mongo = new Mongo("localhost",29017); System.out.println(mongo.getDatabaseNames()); //my actual local mongo = new Mongo("localhost",27017); System.out.println(mongo.getDatabaseNames()); //BUG - try to do connect to remote cluster (29017 is the same as connected to above) mongo = new Mongo(Arrays.asList(new ServerAddress("localhost",29017), new ServerAddress("localhost",29018), new ServerAddress("localhost",29018))); System.out.println(mongo.getDatabaseNames()); //result is that this connects to 27017 on localhost instead of the other server addresses } catch (Exception e) {} } }