Exception while migrating to latest Java Driver

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);
}