I’m trying to migrate from old “uber-jar” mongo-java-driver to new mongodb-driver-sync. When I use version 4.0.5 it works perfectly without code changes. When I try to use 4.1.1 or 4.2.0 - getting exception: org.bson.codecs.configuration.CodecConfigurationException: Can’t find a codec for interface java.util.List
I’ve tried to use corresponding version of mongodb-driver-legacy - same result.
Is it known issue ? Is there a way to use latest driver ?
That doesn’t sound right, if you could post an example reproducing the issue we should be able to help identify the cause. I can’t think of anything in the change log from 4.1.x that would cause that issue.
Hello @Alex_Rubin, I tried the following code with Java Drivers 4.0.5, 4.1.1 and 4.2.0. The code runs just fine. I didn’t know what the variable values are for id_value, value1 and value2 in your code, so substituted the values with my own. It will help if you can provide those too.
try(MongoClient client = MongoClients.create()) {
MongoCollection<Document> collection = client.getDatabase("testdb")
.getCollection("testcoll");
Document document = new Document();
document.put("_id", 1);
document.put("value1", "John Doe");
document.put("value2", "New York");
document.append("date", new Date());
collection.insertOne(document);
}