Skip to content

Instantly share code, notes, and snippets.

@JohnyDays
Created August 1, 2016 15:25
Show Gist options
  • Save JohnyDays/03c6f6b178bae8a84c5897e11feb7244 to your computer and use it in GitHub Desktop.
Save JohnyDays/03c6f6b178bae8a84c5897e11feb7244 to your computer and use it in GitHub Desktop.
MATCH (mainResult: Content)
OPTIONAL MATCH
mainResult<-[relationship0: liked]-(target0: User)
OPTIONAL MATCH
relationship0-[relationship1: liked]->(target1: Content)
OPTIONAL MATCH
relationship1<-[relationship2: liked]-(target2: User)
OPTIONAL MATCH
relationship2-[relationship3: liked]->(target3: Content)
WITH
target1,
target0
{
id: ID(target2),
email: target2.email,
password: target2.password,
username: target2.username,
facebookToken: target2.facebookToken,
methodOfRegistration: target2.methodOfRegistration,
resetPasswordToken: target2.resetPasswordToken,
likedContent: collect(distinct( target3 ))
} as target2
WITH
target0
{
id: ID(target1),
title: target1.title,
description: target1.description,
smallDescription: target1.smallDescription,
location: target1.location,
markerIcon: target1.markerIcon,
listImage: target1.listImage,
headerType: target1.headerType,
headerImages: target1.headerImages,
headerVideo: target1.headerVideo,
tabInfo: target1.tabInfo,
tabMedia: target1.tabMedia,
tabContacts: target1.tabContacts,
media: target1.media,
startDate: target1.startDate,
endDate: target1.endDate,
contacts: target1.contacts,
likedByUsers: collect(distinct( target2 ))
} as target1
WITH
{
id: ID(target0),
email: target0.email,
password: target0.password,
username: target0.username,
facebookToken: target0.facebookToken,
methodOfRegistration: target0.methodOfRegistration,
resetPasswordToken: target0.resetPasswordToken,
likedContent: collect(distinct( target1 ))
} as target0
WITH
{
id: ID(mainResult),
title: mainResult.title,
description: mainResult.description,
smallDescription: mainResult.smallDescription,
location: mainResult.location,
markerIcon: mainResult.markerIcon,
listImage: mainResult.listImage,
headerType: mainResult.headerType,
headerImages: mainResult.headerImages,
headerVideo: mainResult.headerVideo,
tabInfo: mainResult.tabInfo,
tabMedia: mainResult.tabMedia,
tabContacts: mainResult.tabContacts,
media: mainResult.media,
startDate: mainResult.startDate,
endDate: mainResult.endDate,
contacts: mainResult.contacts,
likedByUsers: collect(distinct( target0 ))
} as mainResult
return mainResult
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment