Hi team,
I’m currently working on using mongodb-driver 4.x in my project and I received the following exception when I run the service.
Caused by: java.lang.NoSuchMethodError: com.mongodb.internal.operation.SyncOperations.find(Lorg/bson/conversions/Bson;Ljava/lang/Class;Lcom/mongodb/internal/client/model/FindOptions;)Lcom/mongodb/internal/operation/ReadOperation;
The specific line I’m executing is:
getCollection().find(...).into(new ArrayList<>());
The parameter I passed in find() method is of type Bson, imported as “import org.bson.conversions.Bson;”
There’s a similar post about this issue java.lang.noSuchMethodError with .iterator or .into when using .find. I added those depedencies in my config file as well but with no luck to resolve this problem.
Config file:
depedencies {
1.0 = {
...
Maven-org-mongodb_mongodb-driver-sync = 4.x;
Maven-org-mongodb_mongodb-driver-core = 4.x;
Maven-org-mongodb_bson = 4.x;
...
}
}
Any suggestion or direction for me to move forward?
Thank you very much!!