here is my cypher query :
MATCH (a : User), (user : User {username : 'lebron'})
WHERE a.phoneNumber IN ['757488374748','+9035115','+90390320303']
AND a.username <> 'lebron'
OPTIONAL MATCH (user)-[f:FOLLOWS]->(a), (a)-[p : POSTS]->(b)
RETURN DISTINCT COLLECT(b.postId) AS postId, a.username AS membername,
f.followRequestStatus AS followRequestStatus, user.private AS userPrivate;
'a' node is user node, 'a' can posts photo, follow other users, like other users photo, pretty much like instagram. What's happening here is that it would give followRequestStatus (f.followRequestStatus) correct only if the relation - [p : POSTS] between nodes a and b > exists. If relation 'p' does not exists, it returns null for relation > 'f' also, even if relation f does exist.
b
is a newly introduced variable (the posts froma
) am I correct in that what this comes down to is outputting followRequestStatus only ifa
has posted something (which could be detected by the collection of postIds not being empty)? – InverseFalcon