Skip to content

Instantly share code, notes, and snippets.

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