I am trying to load the data from csv. I just want to right now list the non matching records.
one which are not there in neo4j but are there in csv
the one which are there in neo but not there in the CSV.
Could there be a simple query?
Query below will give matching ones.
< LOAD CSV WITH HEADERS FROM "file:///mydetails.csv" AS records FIELDTERMINATOR ',' WITH records WHERE not records.PersonId IS NULL match (p:Person{Id:records.PersonId)}) return p.Id, records.PersonId limit 10000 />
Below Query will give the non matching but is it ok or we have a different way?
<
LOAD CSV WITH HEADERS FROM "file:///mydetails.csv" AS records FIELDTERMINATOR ',' WITH records WHERE not records.PersonId IS NULL optional match (p:Person{Id:records.PersonId)}) with records.PersonId as csvPersonId , p.Id as personNeoId, count(records) as csvcount, count(p) as count
with csvPersonId where count = 0
return csvPersonId
Yes, with merge we can create the missing . using on match and on create with merge.
But right now goal is just to compare the two, we are trying to find out missing records so.