In the case where you want to filter by multiple conditions,
instead of writing multiple WHERE
steps, you can use the AND
and OR
operations
to chain the conditions together.
Both AND
and OR
take a list of expressions that evaluate to a boolean value.
AND
and OR
will return a boolean value themselves.
AND
::WHERE(AND(<condition1>, <condition2>))
::WHERE(OR(<condition1>, <condition2>))
Examples
AND
QUERY GetUsers(name: String) =>
users <- N<User>::WHERE(
AND(
_::{age}::GT(18),
_::{age}::LT(30)
)
)
RETURN users
QUERY GetUsers(name: String) =>
users <- N<User>::WHERE(
OR(
_::{age}::GT(18),
_::{age}::LT(30)
)
)
RETURN users
AND
and OR
QUERY GetUsers(name: String) =>
users <- N<User>::WHERE(
AND(
_::{age}::GT(18),
OR(
_::{name}::EQ("John"),
_::{name}::EQ("Jane")
)
)
)
RETURN users