MongoClienturi uri = new MongoClienturi(
"mongodb+srv://<username>:<password>cluster0-kjxf3.mongodb.net/test?retryWrites=true&w=majority");
MongoClient mongoClient = new MongoClient(uri);
返回Response message:Exception: java.lang.IllegalArgumentException: uri needs to start with mongodb://
。上面的URL示例来自MongoDB Atlas手册,删除了 + srv 原因:
java.net.UnknownHostException: mongodb.net: Name or service not known