Java MongoDB Sync 4.7.2 driver error with listDatabaseNames request

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()
            MongoClient client = MongoClients.create(settings);

Is there something I’m missing here?

The Stable API was introduced in MongoDB 5.0, so it’s necessary to upgrade your Atlas cluster to 5.0+ before starting to use it.


1 Like