memgraphdb

Why does the "match (n:Label1|Label2) return n" throw an error?


I'm looking into migrating one project from Neo4J to Memgraph as part of my CS class. I got stuck on issue with a query that works in Neo4J but throws an error in Memgraph. The query is match (n:Label1|Label2) return n. In Memgraph, it results in an error saying "line 1:16 mismatched input '|' expecting {')', '{', '$'}". Why does this error occur and how can I modify the query to work in Memgraph?


Solution

  • This code should do the trick:

    CREATE (n:T1:T2{id:1});
    MATCH (n:T1:T2) RETURN n;
    MATCH (n:T1) RETURN n;