cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Multiple limits in one query

tomswinkels
Node Clone

Hi,

In this case i will limit one of the subquery.

When i run the query below, the result of the first query 'monitor' returns only one result and not five results.

I can do a slice on the collection, but i think that is not a hard limit in Neo, only for the return?

Is there some other option?

Query

WITH collect(distinct monitor) AS monitors
UNWIND(monitors) AS monitor
WITH monitor
SKIP 0 LIMIT 5
OPTIONAL MATCH (monitor)-[:FOLLOWS]->(capcode:TS_P2000Capcode)
WITH monitor, capcode
SKIP 0 LIMIT 1
WITH monitor, collect(capcode) AS capcodes
WITH {capcodes: capcodes, monitor: monitor} AS monitors
RETURN {monitors: monitors} AS result```
1 ACCEPTED SOLUTION

LIMIT applies to the number of rows, not the number of results per row, so LIMIT 5 means only 5 rows will be taken at that point.

We have a knowledge base entry here you may want to review for more options.

View solution in original post

1 REPLY 1

LIMIT applies to the number of rows, not the number of results per row, so LIMIT 5 means only 5 rows will be taken at that point.

We have a knowledge base entry here you may want to review for more options.