跳过Cypher Neo4j中的收集
这是我的密码查询跳过Cypher Neo4j中的收集,neo4j,cypher,spring-data-neo4j,Neo4j,Cypher,Spring Data Neo4j,这是我的密码查询 MATCH (notification:Notification)-[:CREATED_BY]->(user:User) MATCH (notification)-[:NOTIFICATION_COUNTRY]->(country:Country) WHERE notification.status='PENDING' AND notification.type='SIMPLE' RETURN collect({id:id(notification),message
MATCH (notification:Notification)-[:CREATED_BY]->(user:User)
MATCH (notification)-[:NOTIFICATION_COUNTRY]->(country:Country)
WHERE notification.status='PENDING' AND notification.type='SIMPLE'
RETURN collect({id:id(notification),message:notification.message,updated:notification.lastUpdatedDate,edited:user.username,country:country.name}) as notifications
LIMIT 25
我想要跳过,限制通知。但是,这里我返回通知集合,那么我如何将跳过与集合一起使用,还有其他方法吗?您可以将
SKIP
和LIMIT
与with
一起使用,从而在创建集合之前限制通知:
MATCH (notification:Notification)-[:CREATED_BY]->(user:User)
MATCH (notification)-[:NOTIFICATION_COUNTRY]->(country:Country)
WHERE notification.status='PENDING' AND notification.type='SIMPLE'
WITH notification
SKIP 10
LIMIT 20
RETURN collect({id:id(notification),message:notification.message,updated:notification.lastUpdatedDate,edited:user.username,country:country.name}) as notifications
您可以将
SKIP
和LIMIT
与with
一起使用,从而在创建收藏之前限制通知:
MATCH (notification:Notification)-[:CREATED_BY]->(user:User)
MATCH (notification)-[:NOTIFICATION_COUNTRY]->(country:Country)
WHERE notification.status='PENDING' AND notification.type='SIMPLE'
WITH notification
SKIP 10
LIMIT 20
RETURN collect({id:id(notification),message:notification.message,updated:notification.lastUpdatedDate,edited:user.username,country:country.name}) as notifications
谢谢@Christophe,它工作得很好。我想再问一件事,我们能优化这个查询并比这个查询得到更快的响应吗。我是cypher新手,需要更多提示以更快或正确的方式获得响应。如果您在notification.type和/或statusThank@Christophe上创建索引,则工作正常。我想再问一件事,我们能优化这个查询并比这个查询得到更快的响应吗。我是cypher新手,需要更多提示以更快或正确的方式获得响应来编写查询。如果您在notification.type和/或status上创建索引