diff --git a/pages/querying/clauses/where.md b/pages/querying/clauses/where.md index f8459d8de..1999994c0 100644 --- a/pages/querying/clauses/where.md +++ b/pages/querying/clauses/where.md @@ -22,7 +22,8 @@ order to avoid problems with performance or results. 1.4. [Filter with node properties](#14-filter-with-node-properties)
1.5. [Filter with relationship properties](#15-filter-with-relationship-properties)
1.6. [Check if property is not null](#16-check-if-property-is-not-null)
- 1.7. [Filter with pattern expressions](#17-filter-with-pattern-expressions)
+ 1.7. [Filter with EXISTS expressions](#17-filter-with-exists-expressions)
+ 1.8. [Filter with pattern expressions](#18-filter-with-pattern-expressions)
2. [String matching](#2-string-matching)
3. [Regular Expressions](#3-regular-expressions) 4. [Existential subqueries](#4-existential-subqueries)
@@ -166,9 +167,9 @@ Output: +----------------+----------------+ ``` -### 1.7. Filter with pattern expressions +### 1.7. Filter with EXISTS expressions -Currently, we support pattern expression filters with the `exists(pattern)` +Currently, we support `EXISTS` expression filters with the `exists(pattern)` function, which can perform filters based on neighboring entities: ```cypher @@ -191,6 +192,30 @@ Output: +----------------+ ``` +### 1.8. Filter with pattern expressions + +Currently, we support pattern expression filters inside the `WHERE` clause. + +```cypher +MATCH (p:Person) +WHERE (p)-[:LIVING_IN]->(:Country {name: 'Germany'}) +RETURN p.name +ORDER BY p.name; +``` + +Output: + +```nocopy ++----------------+ +| c.name | ++----------------+ +| Anna | +| John | ++----------------+ +``` + +The pattern expressions can't contain any additional symbols that are not introduced in the previously matched symbols. + ## 2. String matching Apart from comparison and concatenation operators Cypher provides special diff --git a/pages/querying/differences-in-cypher-implementations.mdx b/pages/querying/differences-in-cypher-implementations.mdx index b17f92dc9..2e451799f 100644 --- a/pages/querying/differences-in-cypher-implementations.mdx +++ b/pages/querying/differences-in-cypher-implementations.mdx @@ -187,6 +187,7 @@ Such a construct is not supported in Memgraph, but you can use `collect()` [aggr {

Patterns in expressions

} Patterns in expressions are supported in Memgraph in particular functions, like `exists(pattern)`. +Memgraph also supports filtering based on patterns, like `MATCH (n) WHERE NOT (n)-->()`. In other cases, Memgraph does not yet support patterns in functions, e.g. `size((n)-->())`. Most of the time, the same functionalities can be expressed differently in Memgraph using `OPTIONAL` expansions, function calls, etc.