Reputation: 75
I have a database containing movies and users. Users can follow each other and rate movies. I have a user with the id 599. I want to find all the movies he hasn't watched that the other users he follows have watched. Here's what I tried so far. I do get a result and it works but the numbers don't really add up so I think there might be something off.
MATCH (u:user {id:599}),(m2:Movie), (u2:user),(u)-[r]->(u2),(u2)-->(m2)
WHERE not (u)-->(m2)
RETURN m2.title, m2.movieId,u2.id;
Upvotes: 0
Views: 50
Reputation: 66999
As @Inversefalcon stated, perhaps your query needs to be specific about the relationship types, in case there are multiple types of relationships between the same nodes.
For example (assuming your data model has the relationship types FOLLOWS
and WATCHED
):
MATCH (u:user {id:599})-[:FOLLOWS]->(u2:user)-[:WATCHED]->(m2:Movie)
WHERE not (u)-[:WATCHED]->(m2)
RETURN m2.title, m2.movieId, u2.id;
If this does not solve your issue, then please provide some sample data and what your expected number of results is.
Upvotes: 1