mongodb_ecto
mongodb_ecto copied to clipboard
Issue with $in clause?
trafficstars
I'm trying to perform a where clause with a $in but without success:
Hookshot.Hook.with_events([1, 2]) |> Hookshot.Repo.all
** (Ecto.Query.CastError) web/models/hook.ex:63: value `[1, 2]` in `where` cannot be cast to type {:in, {:array, :string}} in query:
from h in Hookshot.Hook,
where: h.events in ^[1, 2],
select: h
(elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:1325: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
(elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
(ecto) lib/ecto/repo/queryable.ex:122: Ecto.Repo.Queryable.execute/5
(ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(iex) lib/iex/evaluator.ex:182: IEx.Evaluator.handle_eval/6
(iex) lib/iex/evaluator.ex:175: IEx.Evaluator.do_eval/4
(iex) lib/iex/evaluator.ex:155: IEx.Evaluator.eval/4
Am I doing something wrong?
I'm using:
{:mongodb_ecto, github: "michalmuskala/mongodb_ecto", branch: "ecto-2.1"},
Ecto 2.1 changed representation query generator receives on in queries to better support SQL caching. It seems the 2.1 branch was not updated.
Is this still an issue on the ecto-2.1 branch?