Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for org.mongodb:mongodb-driver-core v5 #1431

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

codefromthecrypt
Copy link
Member

This adds support for the new org.mongodb:mongodb-driver-core v5 driver via the following:

  • move org.mongodb:mongodb-driver v3 to a maven invoker test
  • change the provided artifact from org.mongodb:mongodb-driver -> org.mongodb:mongodb-driver-core
  • change parsing of the remote IP and port to use reflection because there's no compatible alternative
  • change tests to use mock instead of constructors, as the constructors are also incompatible

Fixes #1430

*/
private static MongoDBDriver findMongoDBDriver() {
try {
Method getHost = ServerAddress.class.getMethod("getHost");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it is worth the effort, but we could use MethodHandles instead of reflection (since this is what reflection is using in latest JDKs under the hood).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can.. technically the old mongodb driver had a floor JRE of 1.6, but I don't think it is widely used enough in that config to matter. If someone complains, we can revert it.

Adrian Cole added 2 commits April 10, 2024 08:40
Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
@codefromthecrypt codefromthecrypt merged commit ef6fbbd into master Apr 10, 2024
3 checks passed
@codefromthecrypt codefromthecrypt deleted the mongodb-v5 branch April 10, 2024 20:10
@codefromthecrypt
Copy link
Member Author

thanks for the help @reta!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support MongoDB client version 5.x
2 participants