Since upgrading from mongo-java-driver to mongodb-driver-sync(4.6.1), I am unable to use createDatastore method because it's looking for a com.mongodb.MongoClient object (which is discontinued) instead of
com.mongodb.client.MongoClient object:
client = MongoClients.create(settings);
datastore = morphia.createDatastore(client, databaseName);
Does anyone know a workaround for this? I've tried casting but that doesn't seem to work.
The changing of
com.mongodb.MongoClienttocom.mongodb.client.MongoClientfor Morphia library was released in 2.0.0:So you should also update your Morphia library to a newer version, for example: