We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 291ae8d commit 58d68eeCopy full SHA for 58d68ee
lib/ecto/query/api.ex
@@ -107,6 +107,26 @@ defmodule Ecto.Query.API do
107
108
@doc """
109
Unary `not` operation.
110
+
111
+ It is used to negate values in `:where`. It is also used to match
112
+ the assert the opposite of `in/2`, `is_nil/1`, and `exists/1`.
113
+ For example:
114
115
+ from p in Post, where: p.id not in [1, 2, 3]
116
117
+ from p in Post, where: not is_nil(p.title)
118
119
+ # Retrieve all the posts that doesn't have comments.
120
+ from p in Post,
121
+ as: :post,
122
+ where:
123
+ not exists(
124
+ from(
125
+ c in Comment,
126
+ where: parent_as(:post).id == c.post_id
127
+ )
128
129
130
"""
131
def not(value), do: doc! [value]
132
0 commit comments