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.