Skip to content

Commit

Permalink
tags for LIMIT and FOREACH
Browse files Browse the repository at this point in the history
  • Loading branch information
rsill-neo4j committed Dec 19, 2024
1 parent 943cf62 commit d932269
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/ROOT/pages/clauses/foreach.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ CREATE
This query will set the property `marked` to `true` on all nodes along a path.

.Query
tag::clauses_foreach[]
[source, cypher, indent=0]
----
MATCH p=(start)-[*]->(finish)
WHERE start.name = 'A' AND finish.name = 'D'
FOREACH (n IN nodes(p) | SET n.marked = true)
----
end::clauses_foreach[]

.Result
[role="queryresult",options="footer",cols="1*<m"]
Expand Down
4 changes: 4 additions & 0 deletions modules/ROOT/pages/clauses/limit.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,14 @@ Properties set: 1
`LIMIT` can be used as a standalone clause, or in conjunction with xref:clauses/order-by.adoc[`ORDER BY`] or xref:clauses/skip.adoc[`SKIP`]/xref:clauses/skip.adoc#offset-synonym[`OFFSET`].

.Standalone use of `LIMIT`
tag::clauses_limit_standalone[]
[source, cypher]
----
MATCH (n)
LIMIT 2
RETURN collect(n.name) AS names
----
tag::clauses_limit_standalone[]

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
Expand All @@ -185,6 +187,7 @@ The following query orders all nodes by `name` descending, skips the two first r
It then xref:functions/aggregating.adoc#functions-collect[collects] the results in a list.

.`LIMIT` used in conjunction with `ORDER BY` and `SKIP`
tag::clauses_limit[]
[source, cypher]
----
MATCH (n)
Expand All @@ -193,6 +196,7 @@ SKIP 2
LIMIT 2
RETURN collect(n.name) AS names
----
end::clauses_limit[]

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
Expand Down

0 comments on commit d932269

Please sign in to comment.