我正在尝试查找所有在其User
字段中没有特定字符串元素的match_history
。我对此猜测:matched_user = User |> where([u], ^device_id not in u.match_history) |> limit(1) |> VideoChat.Repo.one
但是它似乎在not
部分破裂。有没有办法做到这一点?
最佳答案
尝试User |> where([u], not ^device_id in u.match_history)
关于elixir - Elixir + Ecto:如何不在[array]中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41005307/