cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any document/code sample talking about pagination of query relationship in SDN 6?

dfwcrm
Node

I am in the process to upgrade Neo4j from SDN 5 to SDN 6 and I have found that all query pagination is no longer working since the relationship data is now put within the node entity. In such new SDN 6 case, how do we do pagination on the query to the relationship data? Is there here any documentation/sample code to help solve this ?

1 REPLY 1

gerrit_meier
Neo4j
Neo4j

I see two questions there.
Question one: How to get relationships back?
Question two: How to paginate with relationships?

For question one: SDN is 100% focused on nodes as entities. This means that you can only can get a hold of the relationships if you load the relationship defining nodes.

Question two: Given a scenario with User and Hobby resulting in the following pseudo-Cypher graph:

(User1)-[:LIKES{since: 1993}]->(Football)
(User1)-[:LIKES{since: 2015}]->(Music)
(User2)-[:LIKES{since: 2010}]->(Darts)
...

You could create a pagination query like:

@Query(
value = "MATCH (u:User)-[l:LIKES]-() return u ORDER by l.since SKIP $skip LIMIT $limit",
countQuery = "MATCH (u:User) return count(u)")
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.