Skip to content

Conversation

@jyemin
Copy link

@jyemin jyemin commented Feb 27, 2025

Upgrade MongoDB Driver to latest available release.

Note that as of 4.0 the mongo-java-driver uber jar is no longer published, so using mongodb-driver-legacy (which will pull in transitive dependencies) in its place.

I'll also note that I wasn't able to build the project locally without errors so I'm using the PR to check whether everything still works.

#32088


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@github-actions github-actions bot added the build label Feb 27, 2025
@jyemin jyemin changed the title Update MongodB driver to mongodb-driver-legacy:5.3.1 Update MongoDB driver to mongodb-driver-legacy:5.3.1 Feb 27, 2025
mockito_core : "org.mockito:mockito-core:3.7.7",
mockito_inline : "org.mockito:mockito-inline:4.5.1",
mongo_java_driver : "org.mongodb:mongo-java-driver:3.12.11",
mongo_java_driver : "org.mongodb:mongodb-driver-legacy:5.3.1",
Copy link
Author

Choose a reason for hiding this comment

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

To minimize the changes, I left the name of the library as is, but happy to change it to mongodb-driver-legacy if that makes sense.

@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

private DBCursor createCursor(GridFS gridfs) {
if (spec.filter() != null) {
DBObject query = (DBObject) JSON.parse(spec.filter());
DBObject query = BasicDBObject.parse(spec.filter());
Copy link
Author

Choose a reason for hiding this comment

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

The Extended JSON syntax accepted by BasicDBObject#parse is mostly consistent with the syntax accepted by JSON#parse. To understand whether this might cause compatibility issues, can anyone point me to how spec.filter() is initialized? Does the filter come from the application or is it generated by the framework, and if the later, where in the code does that happen?

@derrickaw
Copy link
Collaborator

assign set of reviewers

@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @robertwb for label java.
R: @Abacn for label build.
R: @johnjcasey for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@jyemin
Copy link
Author

jyemin commented Mar 18, 2025

Apologies for not being able to get all the checks to pass. Would appreciate some assistance.

@Abacn
Copy link
Contributor

Abacn commented Mar 18, 2025

The failed test is

org.junit.ComparisonFailure: expected:<{"$match": {"[_id": {"$gt": {"$oid": "52cc8f6254c5317943000005"}}]}}> but was:<{"$match": {"[$and": [{"_id": {"$gt": {"$oid": "52cc8f6254c5317943000005"}}}]]}}>
	at org.junit.Assert.assertEquals(Assert.java:117)

From failed test, go to "Summary", One can see "For more details on these failures, see this check" with a link, then the stack trace for failed test is there.

Also, there is "JUnit Test Results" uploaded in Artifact Section and one can download

@github-actions
Copy link
Contributor

Reminder, please take a look at this pr: @robertwb @Abacn @johnjcasey

@jyemin
Copy link
Author

jyemin commented Mar 26, 2025

The 5.4.0 driver was recently released, and I updated the dependency to reflect that. Note that 5.4.0, for the first time, includes a BOM. I'm unsure how to reference the BOM in this project, but perhaps maintainers can advise.

@jyemin jyemin changed the title Update MongoDB driver to mongodb-driver-legacy:5.3.1 Update MongoDB driver to mongodb-driver-legacy:5.4.0 Mar 26, 2025
@jyemin
Copy link
Author

jyemin commented Mar 26, 2025

Also unclear why this error is happening:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sdks:java:extensions:sql:analyzeClassesDependencies'.
> Dependency analysis found issues.
  usedUndeclaredArtifacts
   - org.mongodb:bson:5.4.0@jar
   - org.mongodb:mongodb-driver-core:5.4.0@jar
  unusedDeclaredArtifacts
   - org.mongodb:mongodb-driver-legacy:5.4.0@jar

Can anyone advise?

@Abacn
Copy link
Contributor

Abacn commented Mar 26, 2025

Also unclear why this error is happening:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sdks:java:extensions:sql:analyzeClassesDependencies'.
> Dependency analysis found issues.
  usedUndeclaredArtifacts
   - org.mongodb:bson:5.4.0@jar
   - org.mongodb:mongodb-driver-core:5.4.0@jar
  unusedDeclaredArtifacts
   - org.mongodb:mongodb-driver-legacy:5.4.0@jar

Can anyone advise?

This is a gradle-dependency-analyze check. It suggests in ":sdks:java:extensions:sql" it is still mongodb-driver-core instead of mongodb-driver-legacy are actually used one

@jyemin
Copy link
Author

jyemin commented Apr 1, 2025

@Abacn I tried various combinations of dependencies, but have not been able to find the right combination that works. I would appreciate if someone with more knowledge of the build system could give it a shot, but I understand if this PR is not top of mind for the maintainers.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2025

Reminder, please take a look at this pr: @robertwb @Abacn @johnjcasey

@github-actions
Copy link
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @kennknowles for label java.
R: @damccorm for label build.
R: @johnjcasey for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

@damccorm
Copy link
Contributor

R: @Abacn (keeping sticky since Yi has started to review)

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@github-actions
Copy link
Contributor

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 14, 2025
@chamikaramj
Copy link
Contributor

@jyemin could you address the error and resolve the conflict so that the review can continue ?

Please let us know if you need additional help.

@github-actions github-actions bot removed the stale label Jun 21, 2025
@derrickaw
Copy link
Collaborator

waiting on author

@github-actions
Copy link
Contributor

github-actions bot commented Oct 6, 2025

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 6, 2025
@github-actions
Copy link
Contributor

This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions bot closed this Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants