The above request results in the following error on an Atlas version 4.2 cluster:
Command failed with error 40415 (Location40415): 'BSON field 'listDatabases.apiVersion' is an unknown field.' on server ... "errmsg": "BSON field 'listDatabases.apiVersion' is an unknown field.", "code": 40415, "codeName": "Location40415"
Here’s how I set up the MongoDB client in the Java code:
ConnectionString connectionString = new ConnectionString(url);
MongoClientSettings settings = MongoClientSettings.builder()
.applyConnectionString(connectionString)
.serverApi(ServerApi.builder()
.version(ServerApiVersion.V1)
.build())
.build();
MongoClient client = MongoClients.create(settings);
Is there something I’m missing here?