private boolean serversAreAllThreeDotFour(final ClusterDescription clusterDescription) { for (ServerDescription cur : clusterDescription.getServerDescriptions()) { if (cur.isOk() && cur.getMaxWireVersion() < 5) { return false; } } return true; }
private MongoIncompatibleDriverException createIncompatibleException(final ClusterDescription curDescription) { String message; ServerDescription incompatibleServer = curDescription.findServerIncompatiblyOlderThanDriver(); if (incompatibleServer != null) { message = format("Server at %s reports wire version %d, but this version of the driver requires at least %d (MongoDB %s).", incompatibleServer.getAddress(), incompatibleServer.getMaxWireVersion(), MIN_DRIVER_WIRE_VERSION, MIN_DRIVER_SERVER_VERSION); } else { incompatibleServer = curDescription.findServerIncompatiblyNewerThanDriver(); message = format("Server at %s requires wire version %d, but this version of the driver only supports up to %d.", incompatibleServer.getAddress(), incompatibleServer.getMinWireVersion(), MAX_DRIVER_WIRE_VERSION); } return new MongoIncompatibleDriverException(message, curDescription); }
private boolean serversAreAllThreeDotFour(final ClusterDescription clusterDescription) { for (ServerDescription cur : clusterDescription.getServerDescriptions()) { if (cur.isOk() && cur.getMaxWireVersion() < 5) { return false; } } return true; }
private MongoIncompatibleDriverException createIncompatibleException(final ClusterDescription curDescription) { String message; ServerDescription incompatibleServer = curDescription.findServerIncompatiblyOlderThanDriver(); if (incompatibleServer != null) { message = format("Server at %s reports wire version %d, but this version of the driver requires at least %d (MongoDB %s).", incompatibleServer.getAddress(), incompatibleServer.getMaxWireVersion(), MIN_DRIVER_WIRE_VERSION, MIN_DRIVER_SERVER_VERSION); } else { incompatibleServer = curDescription.findServerIncompatiblyNewerThanDriver(); message = format("Server at %s requires wire version %d, but this version of the driver only supports up to %d.", incompatibleServer.getAddress(), incompatibleServer.getMinWireVersion(), MAX_DRIVER_WIRE_VERSION); } return new MongoIncompatibleDriverException(message, curDescription); }