From dc6a61030ca8b14b8658f13144d79e5d828d836f Mon Sep 17 00:00:00 2001 From: Michael Webb Date: Fri, 20 Sep 2024 10:14:43 +0200 Subject: [PATCH] docs: update example for using `this` in custom cypher --- .../type-definitions/directives/cypher.adoc | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/modules/ROOT/pages/type-definitions/directives/cypher.adoc b/modules/ROOT/pages/type-definitions/directives/cypher.adoc index 3001d36e..804c3919 100644 --- a/modules/ROOT/pages/type-definitions/directives/cypher.adoc +++ b/modules/ROOT/pages/type-definitions/directives/cypher.adoc @@ -19,21 +19,17 @@ Global variables are available for use within the Cypher statement and can be ap a| [source, graphql, indent=0] ---- -{ - Movie { - title - actors: ACTED_IN @this { - role - actor { - name - } - } - directors: DIRECTED @this { - director { - name - } - } - } +type Movie { + title: String + similarMovies(limit: Int = 10): [Movie] + @cypher( + statement: """ + MATCH (this)<-[:ACTED_IN]-(:Actor)-[:ACTED_IN]->(rec:Movie) + WITH rec, COUNT(*) AS score ORDER BY score DESC + RETURN rec LIMIT $limit + """, + columnName: "rec" + ) } ---- @@ -234,4 +230,4 @@ type Mutation { columnName: "a" ) } ----- \ No newline at end of file +----