You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When connecting using a where clause which produces more than one node to connect to, the update Mutation returns an array entry for each node connected to, when it should only return the root node.
The data itself is in the correct shape, just the return value is off.
Initial investigation finds that the current Cypher is:
MATCH (this:User)
WHERE this.name = $this_name
WITH this
OPTIONAL MATCH (this_connect_movies0:Movie)
WHERE this_connect_movies0.title CONTAINS $this_connect_movies0_title_CONTAINS
FOREACH(_ IN CASE this_connect_movies0 WHEN NULL THEN [] ELSE [1] END |
MERGE (this)-[:OWNS]->(this_connect_movies0)
)
RETURN this { .name, movies: [ (this)-[:OWNS]->(this_movies:Movie) | this_movies { .title } ] } AS this
@danstarns has suggested that refactoring to the following could fix this issue:
MATCH (this:User)
WHERE this.name = $this_name
CALL {
WITH this
OPTIONAL MATCH (this_connect_movies0:Movie)
WHERE this_connect_movies0.title CONTAINS $this_connect_movies0_title_CONTAINS
FOREACH(_ IN CASE this_connect_movies0 WHEN NULL THEN [] ELSE [1] END |
MERGE (this)-[:OWNS]->(this_connect_movies0)
)
RETURN count(*)
}
RETURN this { .name, movies: [ (this)-[:OWNS]->(this_movies:Movie) | this_movies { .title } ] } AS this
Describe the bug
When connecting using a where clause which produces more than one node to connect to, the update Mutation returns an array entry for each node connected to, when it should only return the root node.
The data itself is in the correct shape, just the return value is off.
Type definitions
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The result to be:
System (please complete the following information):
The text was updated successfully, but these errors were encountered: