[COMPASS-7585] Converting a pipeline to Java results in unresolved imports / errors Created: 17/Jan/24  Updated: 07/Feb/24

Status: Open
Project: Compass
Component/s: Export to Language
Affects Version/s: 1.41.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Graeme Robinson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS: MacOS


Assigned Teams:
Developer Tools
Story Points: 3
Quarter: FY25Q1

 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. 


Generated at Wed Feb 07 22:47:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.