Details
-
Bug
-
Resolution: Unresolved
-
Major - P3
-
None
-
1.41.0
-
None
-
OS: MacOS
-
Developer Tools
-
3
Description
Converting a pipeline to Java using Compass (1.41.0) with the "include imports" and "include driver syntax" options both set to yes results in errors because two of the imports can't be resolved:
import com.mongodb.MongoClient; |
import com.mongodb.MongoClientURI; |
These appear to be using the legacy API and neither appear to be in the 4.11.1 driver jar.The code the attempts to create a MongoClient using the legacy approach:
MongoClient mongoClient = new MongoClient( |
new MongoClientURI( |
"mongodb+srv://<user>:<password>@perftestcluster.azzy6.mongodb.net/" |
)
|
);
|
But it then calls getDatabase, rather than getDB i.e. the modern API call, rather than the legacy call:
MongoDatabase database = mongoClient.getDatabase("PerformanceWorkshop"); |
Looks like this needs a bit of tidy up.
This was observed in in an IntelliJ Gradle project with the 4.11.1 Java sync driver and JDK 17.