KWriter
KWriter

Reputation: 1180

Using patterns in expressions with Memgraph

When I run the follwing query, I get an error:

MATCH (n:NodeA)
WHERE NOT (n)-[]->(:NodeB)
RETURN n;

After executing it I receive an error:

Not yet implemented: atom expression '(n)-[]->(:NodeB)'

How can I run such query in Memgrpah?

Upvotes: 0

Views: 84

Answers (1)

KWriter
KWriter

Reputation: 1180

The same query can be expressed using the OPTIONAL MATCH clause. The clause OPTIONAL MATCH behaves the same as a regular MATCH, but when it fails to find the pattern, missing parts of the pattern will be filled with null values.

The example query would look like this:

OPTIONAL MATCH (n:NodeA)-[]->(m:NodeB)
WHERE m IS null
RETURN DISTINCT n;

Upvotes: 0

Related Questions