Open thobe opened 7 years ago
One could also imagine extending this syntax to allow selecting variables for inclusion in the map, and for allowing regular map entries:
MATCH (manager:Employee{employmentId:$managerId})-[:MANAGES]->(employee:Employee)
MATCH (employee)-[:WORKS_IN]->(group)<-[:WORKS_IN]-(colleague)
WITH employee, manager.name AS manager, collect(colleague) AS colleagues
RETURN employee{
// select some properties of the 'employee' node:
.employmentId,
.email,
.name,
// select a variable for inclusion as-is:
manager,
// include a regular key-value entry:
co_workers: [co_worker IN colleagues | co_worker{.name, .employmentId}]
}
Combining this with the comprehension subquery suggested in #177 would make things even nicer (and almost directly mappable from Facebook's GraphQL):
MATCH (manager:Employee{employmentId:$managerId})-[:MANAGES]->(employee:Employee)
RETURN employee{
.employmentId,
.email,
.name,
manager{.employmentId, .email, .name},
co_workers: [
MATCH (employee)-[:WORKS_IN]->(group)<-[:WORKS_IN]-(colleague)
RETURN colleague{.name, .employmentId}
]
}
(Updated the original comment to include the name of the CIR)
CIR-2017-178
It is a common requirement to return only a handful of properties from a node, in cases where the actual node has many more properties than that. Currently this requires quite repetitive syntax:
It would be nice to have a shorter syntax to allow selecting the properties to return: