I am using mongo java driver along with clojure for mongo connection, to establish connection in java I am using following code snippet
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.ServerAddress;
MongoClientURI uri = new MongoClientURI("mongodb://xxx:***@url:27017/test?readPreference=primary");
List<String> hosts = uri.getHosts();
List<ServerAddress> serverList = new LinkedList<>();
for(String host:hosts) {
serverList.add(new ServerAddress(host)); //updated
}
I want to get this same functionality in clojure so I tried this
(def uri (MongoClientURI. uri))
(def hosts (.getHosts uri))
Now I have List of hosts which are String, how do I convert them to list of type ServerAddress ?