Skip to content
New issue

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

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

Already on GitHub? # to your account

order_by does not work with Ecto 3.12 #197

Open
sriedel opened this issue Dec 15, 2024 · 2 comments
Open

order_by does not work with Ecto 3.12 #197

sriedel opened this issue Dec 15, 2024 · 2 comments

Comments

@sriedel
Copy link
Contributor

sriedel commented Dec 15, 2024

Using ecto 3.12.5, attempting to sort the result of a query with the following query pipeline

iex(17)> TodoItem |> order_by(asc: :id) |> Repo.all

results in the error

** (FunctionClauseError) no function clause matching in anonymous fn/1 in Mongo.Ecto.NormalizedQuery.order/2

    The following arguments were given to anonymous fn/1 in Mongo.Ecto.NormalizedQuery.order/2:

        # 1
        %Ecto.Query.ByExpr{
          expr: [asc: {{:., [], [{:&, [], [0]}, :id]}, [], []}],
          file: "iex",
          line: 17,
          params: nil,
          subqueries: []
        }

    (mongodb_ecto 2.0.0-rc.2) lib/mongo_ecto/normalized_query.ex:772: anonymous fn/1 in Mongo.Ecto.NormalizedQuery.order/2

It seems the name of the Struct was changed from Query.QueryExpr to Query.ByExpr.

@scottmessinger
Copy link
Collaborator

@sriedel Sorry for the slow response! Great catch. @mweidner037 Could you take a look at the related PR?

@scottmessinger
Copy link
Collaborator

@sriedel We've run into this and are looking into it!

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

No branches or pull requests

2 participants