Elixir + Ecto:如何在[数组]中不存在?

big*_*ato 11 elixir ecto

我试图寻找User在他们的match_history领域中没有某个字符串元素的所有s .我猜了一下:

matched_user = User |> where([u], ^device_id not in u.match_history) |> limit(1) |> VideoChat.Repo.one

但它似乎打破了not部分.有没有办法做到这一点?

小智 13

尝试

User |> where([u], not ^device_id in u.match_history)