neo4j - In a single query how to get feeds and also the information about which feeds have been liked by the logged in user -
match (f:feed) f.feedtype = 'sports' return f order f.timeadded desc skip 4 limit 10
i have user node , feed node. want retrieve feeds related sports pagination. have written query above. need know resulting feeds have been liked logged in user. suppose have user username john, how add [:like] relation above query additional information user-feed relationship.
you can start matching user , expand pattern optional match
after pagination :
match (john:user {name:'john'}), (f:feed) f.feedtype = 'sports' john, f order f.timeadded desc skip 4 limit 10 optional match (john)-[r:liked]->(f) return f, count(r)
this return 0 if john not liked feed, 1 if liked along each feed
Comments
Post a Comment