I've run into the following issue with this Cypher query. The overall results are returned in an array of objects, as intended. However, the collect() clause is giving me some trouble.
If user has no myFriends and no theirFriends , an empty ...
Thanks! That's a neat solution dealing with lists and does answer my question.
I've also come across another solution using map projections.
RETURN {
name: user.name,
friends: collect(myFriends { .id }) + collect(theirFriends { .id }),
teachers...