In the "Using WHERE to Filter Queries" chapter, the Testing with patterns - 2 example is
MATCH (p:Person)-[:WROTE]->(m:Movie)
WHERE NOT exists( (p)-[:DIRECTED]->(m) )
RETURN p.name, m.title
This works perfectly well and returns 6 results.
However, earlier in the Chapter, it is mentioned that the exists() function will be deprecated after v4.3, so I wanted to create the equivalent query using NULL instead. So I tried
MATCH (p:Person)-[:WROTE]->(m:Movie)
WHERE ( (p)-[:DIRECTED]->(m) ) IS NULL
RETURN p.name, m.title
but this returns no results. What have I done wrong?
There are some changes coming, we don't want a pattern to evaluate to a list like this, so WHERE ( (p)-[:DIRECTED]->(m) ) = [] isn't how we want to express this restriction (plus it's really awkward and unintuitive).
I think we're keeping exists() for patterns, but we are deprecating it for property existence checks.
So WHERE NOT exists( (p)-[:DIRECTED]->(m) ) should be fine (and I think you can even go without the exists() here, so WHERE NOT (p)-[:DIRECTED]->(m) should still be fine)
But WHERE NOT exists(m.title) would be deprecated in favor of WHERE m.title IS NULL.