version 4.1.1
I have a scenario where OPTIONAL MATCH does not work. I have two labels I am comparing where I want all items in the first label and the items that exist in the second label.
match (b:OldComponent)
optional MATCH (n:Component {name: b.name})
RETURN b.name, n.name order by b.name;
Returns:
βββββββββββββββββββββββββββββββββββββ€βββββββββ
β"b.name" β"n.name"β
βββββββββββββββββββββββββββββββββββββͺβββββββββ‘
β"#2S15 RED" βnull β
βββββββββββββββββββββββββββββββββββββΌβββββββββ€
β"#6FO <2%" βnull β
βββββββββββββββββββββββββββββββββββββΌβββββββββ€
β"115 LATEX, TOTE, LB" βnull β
If I remove the OPTIONAL I get:
ββββββββββββββββββ€ββββββββββββββββ
β"b.name" β"n.name" β
ββββββββββββββββββͺβββββββββββββββββ‘
β"#2S15 RED" β"#2S15 RED" β
ββββββββββββββββββΌββββββββββββββββββ€
β"#6FO <2%" β"#6FO <2%" β
As you can see from the result without the OPTIONAL the data does exist.
I have rebuilt the constraints/indexes but still the same results.
I tried to create a sample set of data in another database but could not recreate the issue.
Any ideas?
Sorry for the formatting. Couldn't figure out how to get it corrected.