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

Ecto 3.12: Add Query.ByExpr structs next to the old Query.QueryExpr struct matching #198

Merged
merged 3 commits into from
Mar 8, 2025

Conversation

sriedel
Copy link
Contributor

@sriedel sriedel commented Dec 16, 2024

Addresses #197

To get mongodb_ecto working with ecto 3.12 I've done the naive thing and added Ecto.Query.ByExpr structs next to the places where Ecto.Query.QueryExpr was present.

After the manually updating ecto to 3.12.5, the existing unit tests are working.

However I would need guidance on how to properly set up the tests to work with both struct types, or how to not throw an error when using with an older ecto version that does not define this struct. Nor do I have any knowledge on how matrix testing works in elixir, so pointers on where the configuration would need to be updated would be appreciated as well :).

@sriedel sriedel changed the title Add Ecto.Query.ByExpr structs for ecto 3.12+ next to the old Ecto.Que… Ecto 3.12: Add Query.ByExpr structs next to the old Query.QueryExpr struct matching Dec 16, 2024
@mweidner037
Copy link
Collaborator

Thanks @sriedel ! This looks reasonable to me in comparison to the ecto_sql analog (elixir-ecto/ecto_sql#607). Though I'm not sure why we cannot replace ByExpr with QueryExpr entirely (without your duplicate cases, the tests indeed fail).

Since ByExpr was added in Ecto 3.12, we need to bump our dependency on Ecto, and consumers will need to upgrade in sync. It is the same situation as ecto_sql.

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