\a SELECT * FROM cypher('MATCH (m:Movie) WHERE m.title CONTAINS ''The Matrix'' RETURN m ORDER BY id(m) DESC'); cypher {"m":{"id": 10,"labels": ["Movie"],"properties": {"tagline": "Everything that has a beginning has an end", "title": "The Matrix Revolutions", "released": 2003}}} {"m":{"id": 9,"labels": ["Movie"],"properties": {"tagline": "Free your mind", "title": "The Matrix Reloaded", "released": 2003}}} {"m":{"id": 0,"labels": ["Movie"],"properties": {"tagline": "Welcome to the Real World", "title": "The Matrix", "released": 1999}}} (3 rows) SELECT * FROM cypher('MATCH (m:Movie) WHERE m.title CONTAINS "The Matrix" RETURN m ORDER BY id(m) DESC'); cypher {"m":{"id": 10,"labels": ["Movie"],"properties": {"tagline": "Everything that has a beginning has an end", "title": "The Matrix Revolutions", "released": 2003}}} {"m":{"id": 9,"labels": ["Movie"],"properties": {"tagline": "Free your mind", "title": "The Matrix Reloaded", "released": 2003}}} {"m":{"id": 0,"labels": ["Movie"],"properties": {"tagline": "Welcome to the Real World", "title": "The Matrix", "released": 1999}}} (3 rows) SELECT * FROM cypher('MATCH (m:Movie) WHERE m.title CONTAINS $search RETURN m ORDER BY id(m) DESC','{''search'':''Matrix''}'); cypher {"m":{"id": 10,"labels": ["Movie"],"properties": {"tagline": "Everything that has a beginning has an end", "title": "The Matrix Revolutions", "released": 2003}}} {"m":{"id": 9,"labels": ["Movie"],"properties": {"tagline": "Free your mind", "title": "The Matrix Reloaded", "released": 2003}}} {"m":{"id": 0,"labels": ["Movie"],"properties": {"tagline": "Welcome to the Real World", "title": "The Matrix", "released": 1999}}} (3 rows) SELECT * FROM cypher('MATCH (m:Movie) WHERE m.title CONTAINS $search RETURN m ORDER BY id(m) DESC','{"search":"Matrix"}'); cypher {"m":{"id": 10,"labels": ["Movie"],"properties": {"tagline": "Everything that has a beginning has an end", "title": "The Matrix Revolutions", "released": 2003}}} {"m":{"id": 9,"labels": ["Movie"],"properties": {"tagline": "Free your mind", "title": "The Matrix Reloaded", "released": 2003}}} {"m":{"id": 0,"labels": ["Movie"],"properties": {"tagline": "Welcome to the Real World", "title": "The Matrix", "released": 1999}}} (3 rows) SELECT name, born FROM cypher('MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE m.title=$movie RETURN p.name AS name, p.born AS born ORDER BY born DESC','{"movie":"The Matrix"}') , json_to_record(cypher) as x(name varchar, born smallint); name|born Emil Eifrem|1978 Carrie-Anne Moss|1967 Keanu Reeves|1964 Laurence Fishburne|1961 Hugo Weaving|1960 (5 rows) select json_object_agg(key,value::jsonb-'id') as result from cypher('create (a:A {name : "test"}),(b:B {name : "thing"}),(c:B {name : "other"}) return *;') c, lateral json_each(c); result { "a" : {"labels": ["A"], "properties": {"name": "test"}}, "b" : {"labels": ["B"], "properties": {"name": "thing"}}, "c" : {"labels": ["B"], "properties": {"name": "other"}} } (1 row) select c->'r'->>'type' as rel_type,c->'r'->>'properties' as rel_properties,json_array_length(json_agg(n)) as node_count from cypher('match(a),(b) where a.name = "test" and b.name = "thing" CREATE (a)-[r:RELTYPE {name : "test-thing"}]->(b) return r;') c, lateral json_array_elements(c->'r'->'nodes') n group by 1,2; rel_type|rel_properties|node_count RELTYPE|{"name": "test-thing"}|2 (1 row) select c->'r'->>'type' as rel_type,c->'r'->>'properties' as rel_properties,json_array_length(json_agg(n)) as node_count from cypher('match(a),(b) where a.name = "thing" and b.name = "other" CREATE (a)-[r:RELTYPE {name : "thing-other"}]->(b) return r;') c, lateral json_array_elements(c->'r'->'nodes') n group by 1,2; rel_type|rel_properties|node_count RELTYPE|{"name": "thing-other"}|2 (1 row) select segment->>'type' as rel_type,segment->'properties' as rel_properties from cypher('match p = (a) - [*] -> (b) where a.name = "test" and b.name = "other" return p;') c, lateral json_array_elements(c->'p') segment; rel_type|rel_properties RELTYPE|{"name": "test-thing"} RELTYPE|{"name": "thing-other"} (2 rows)