MongoClientOptions.Builder addClusterListener(ClusterListener clusterListener)Adds the given cluster listener.//添加给定的集群监听器 MongoClientOptions.Builder addCommandListener(CommandListener commandListener)Adds the given command listener.//添加给定的命令监听器 Mong
mongodb链接有多种:所以不同链接下的api也不太一样. 1.api比较全面 public void query2(){ String mondburl = Config.getInstance().getProperty("mongodb.host"); MongoClientOptions options = new MongoClientOptions.Builder().socketKeepAlive(true).build(); Mongo client = new Mo