Skip to content

Conversation

@darycabrera
Copy link
Contributor

The mongoDB driver library introduced breaking changes to the current API calls used in persistent when interfacing with a mongoDB Server version 6.0 and above. Two of those changes, namely the change in behavior of the delete and update functions, seem irrational to me, but regardless they're already officially incorporated.

This PR makes the necessary changes to restore expected functionality whilst remaining backwards compatible with previous mongoDB versions, namely MongoDB 5.0, the EOL for which comes up this October. As alluded to, these changes were prompted for the mongoDB upgrade effort at work.

The mongo driver package itself needs a little more work to conform the server spec changes brought along with the Mongo Wire version 17, however, that is independent of these changes.

This flag was deprecated since Mongo Server 3.7.4.
Its presence in queries produce failures in the mongoDB driver when
interfacing against Mongo Servers >= version 6.0.
Replace the mongo driver's delete calls with deleteMany to restore
correct behavior with Mongo 6.0 while preserving compatibility
with Mongo 5.0.
Replace the mongo driver's modify(update) calls with updateMany to
restore correct behavior in Mongo 6.0 and above.

The key change here is that the writeConcern is now back to being set
based on environment context rather than being hardcoded to "0".
Copy link
Collaborator

@parsonsmatt parsonsmatt left a comment

Choose a reason for hiding this comment

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

I think this PR needs some additional version bounds on the underlying mongo library. It seems like the interface is unchanged so it would be a patch version bump.

Match the current stack snapshot at version 2.7.1.2.
@parsonsmatt
Copy link
Collaborator

Hm, incompatible with GHC 8.4.4 because of mongoDB's version constraints - would require dropping support for GHC 8.4 and 8.6. That's unfortunate. GHC 8.4 is ~8 years old now, and 8.6 is 6 years old. I think I'm OK dropping those versions from our CI.

We can do a follow-up PR to tighten our own base bounds and see what things we can adopt with 8.8 as our oldest compiler target.

@parsonsmatt
Copy link
Collaborator

OK, changes look good to me! Please add a changelog entry and a version bump for persistent-mongoDB and we'll get it released.

Copy link
Collaborator

@parsonsmatt parsonsmatt left a comment

Choose a reason for hiding this comment

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

AWesome thanks! I'll have this uploaded today.

@parsonsmatt parsonsmatt merged commit e6a0a9f into yesodweb:master Sep 6, 2024
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.

2 participants