Skip to content

Allow simple return pattern for single results #2269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
meistermeier opened this issue May 31, 2021 · 1 comment
Closed

Allow simple return pattern for single results #2269

meistermeier opened this issue May 31, 2021 · 1 comment
Assignees
Labels
type: enhancement A general enhancement

Comments

@meistermeier
Copy link
Collaborator

Currently it is not possible to generate related entities when there is an obvious simple result similar to:
MATCH (p1:Person)-[r]-(p2:Person) return p1, r, p2
The results for the relationship and related node needs to get wrapped into a list like this:
MATCH (p1:Person)-[r]-(p2:Person) return p1, collect(r), collect(p2)

Would be good to have the option to dismiss the need of collect for 1:1 relationships.

@meistermeier meistermeier added the type: enhancement A general enhancement label May 31, 2021
@michael-simons
Copy link
Collaborator

This will only be possible for one-to-one relationships. A node that has several relations of the same type to other nodes will cause to return more than one record / row. So given

MATCH (p1:Person)-[r:KNOWS]-(p2:Person) return p1, collect(r), collect(p2)

This aggregates all people that p1 knows into dedicated collections and makes that subgraph a single record to be returned.

MATCH (p1:Person)-[r:KNOWS]-(p2:Person) return p1, r, p2

however will be as many records / rows as there different relationships between people and we would not be able to map it.

I'm however all in on simplifying that for the 1-to-1 use case.

@michael-simons michael-simons self-assigned this Jun 8, 2021
michael-simons added a commit that referenced this issue Jun 8, 2021
This allows to ommit the artifial collection of relationships and related nodes for one-to-one relationships and closes #2269.
@michael-simons michael-simons added this to the 6.1.2 (2021.0.2) milestone Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants