public boolean mongoDbCollectionNameUpdate(String oldName,String newName){
MongoClient mongoClient = MongoClients.create(mongourl);
MongoDatabase country = mongoClient.getDatabase("Country");
boolean collectionExists = country.listCollectionNames().into(new ArrayList<String>()).contains(oldName);
if (collectionExists){
MongoCollection<Document> collection = country.getCollection(oldName);
collection.renameCollection(new MongoNamespace("Country",newName),new RenameCollectionOptions().dropTarget(false));
return true;
}
System.out.println("该集合不存在");
return false;
}