跳过 Cypher Neo4j 中的集合
Skip With Collection in Cypher 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:notification.message,updated:notification.lastUpdatedDate,edited:user.username,country:country.name}) as notifications
LIMIT 25
我想要 SKIP,在 notification.But 上限制,这里我返回通知集合,那么我如何使用 SKIP 和集合,还有其他方法吗?
您可以将 SKIP
和 LIMIT
与 WITH
一起使用,从而在创建 collection 之前限制通知:
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
这是我的密码查询
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,在 notification.But 上限制,这里我返回通知集合,那么我如何使用 SKIP 和集合,还有其他方法吗?
您可以将 SKIP
和 LIMIT
与 WITH
一起使用,从而在创建 collection 之前限制通知:
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