-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Update to MongoDB Java driver 4.0.0 #7868
Conversation
...ntime/src/main/java/io/quarkus/mongodb/panache/reactive/runtime/ReactiveMongoOperations.java
Show resolved
Hide resolved
I will try this one on some projects I have that uses more Mongodb functionalities before approving this. I want to be sure that everything works as before with this new major version of the client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added one comment about the new "TDocument" thingy.
Also, do you know why https://docs.mongodb.com/ecosystem/drivers/java/ has not been updated with this version? I would like to be sure we don't lose support for some MongoDB version. If we do we must document it.
@@ -478,7 +502,7 @@ | |||
* @param pipeline the aggregate pipeline | |||
* @return a stream containing the result of the aggregation operation | |||
*/ | |||
AggregatePublisher<Document> aggregateAsPublisher(List<? extends Bson> pipeline); | |||
AggregatePublisher<T> aggregateAsPublisher(List<? extends Bson> pipeline); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this should be considered as a breaking change.
Initially, it only contained Document
, now it can be any type.
First I would use TDocument
as in the driver to indicate that it's not any type, but must be somehow a document. The lack of constraint in the driver is a bit odd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cescoffier TDocument
means any type T
that can be converted to a document. I agree this is a bit odd as it didn't convey any constraint. As we register the Pojo Codec, almost any type can be converted automatically (except for some deep generic types). So maybe T
is OK.
...ntime/src/main/java/io/quarkus/mongodb/panache/reactive/runtime/ReactiveMongoOperations.java
Show resolved
Hide resolved
No Idea why the table on the official site was not updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I check some internal projects (including some basic Kotlin ones) and all works without issue.
It is worth noting that the uber client is no longer available, but as we switch to the new clients in the previous release this should not be an issue.
It is also worth noting that quarkus-camel also provides MongoDB support, maybe we should check on their side before merging this one, @gsmet ?
Maybe @ppalaga or @lburgazzoli can confirm? |
@jamesnetherton is our Mongo expert |
I ran the camel-quarkus integration tests with this change... Unfortunately, the camel-mongo component is currently tied to the 3.x drivers and there are API changes in 4.x which seem to break things. E.g:
What we probably want, is a camel-mongo4 component which uses the newer Mongo libs and APIs. I can't say how much effort that'd be or when we're likely to have that though. |
@jamesnetherton it's surprising because we do use Line 195 in 36650ac
Did you check that you don't have a dependency issue and that all mongodb related libraries are of version 4 ? |
@loicmathieu you're right, I think it should work. Dependencies look fine:
Here's the failure point: I'll have to try and dig into it a bit more. |
It works when the camel component is compiled against the 4.x libs, otherwise we hit the So I think we need a 4.x compatible camel component for this to work. |
@jamesnetherton we will need a coordinated release for Quarkus and Camel-Quarkus, but it's always the case right ? |
@loicmathieu yes, I created a Camel issue to track the upgrade work. |
Is this PR OK to be merged? |
@jamesnetherton |
@ppalaga @lburgazzoli do you think this is ok to be merged? The Camel changes wont be available until 3.2.0 is released, so we'd be blocked upgrading Quarkus to 1.4.0 until it's available. |
Let's not hold this back any longer. I'm ok for it to be merged 👍 |
We definitely want a note about this change in the migration guides.
The interface changes for reactive mongo most likely break user applications.
See also the mongo java driver 4.0 upgrade guide: https://mongodb.github.io/mongo-java-driver/4.0/upgrading