我正在尝试运行以下代码:
public static void main(String args[]) throws UnknownHostException, MongoException{
Mongo m = new Mongo( "localhost", 27017 );
DB db = m.getDB( "test" );
Set<String> coll = db.getCollectionNames();
}
但是由于某些原因,我遇到了连接问题:
bc:java.net.ConnectException: Connection refused: connect
编辑:不好意思,我忘记在后台运行数据库了。