Skip to content

Commit

Permalink
docs: Add example how to access properties of a list element.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-simons committed Nov 23, 2023
1 parent 67e0fb7 commit f38e67b
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4575,6 +4575,18 @@ void shouldSupportExpressions() {
.isEqualTo(
"MATCH (person:`Person`) RETURN person{livesIn: [(person)-[:`LIVES_IN`]->(personLivesIn:`Location`) | personLivesIn{.name}][$personLivedInOffset..($personLivedInOffset + $personLivedInFirst)]}");
}

@Test
void propertiesShouldBeAccessibleOnResolvedNodes() {

var nodes = Cypher.name("nodes");
var cypher = Cypher.match(Cypher.node("Foo").named("n"))
.with(Functions.collect(Cypher.name("n")).as("nodes"))
.returning(Cypher.property(Cypher.valueAt(nodes, 0), "foo"))
.build().getCypher();
assertThat(cypher)
.isEqualTo("MATCH (n:`Foo`) WITH collect(n) AS nodes RETURN nodes[0].foo");
}
}

@Nested
Expand Down

0 comments on commit f38e67b

Please sign in to comment.