Duplicate nodes but with different graph ids

I am writing nodes with the label, SocialUser to the neo4j graph. At the first instance, the graph creates duplicates of the node but gives different graph ids for each duplicate. Can someone please help me solve this issue? I can't seem to find the answer i'm looking for


Hi @nicholas.akorful

Welcome to community.

Could you please help us with the query you used for creating this graph.

You can use merge to avoid duplicacy and or u can add constraints like unique constraint

It would be useful to see your cypher command or your code when you are creating your nodes.
One possible cause is that you do not use MERGE command. If you use CREATE command, that will create a separate node each time, with different (internal) ID.

This is the query. It is in Java, The play framework

That should not create duplicates. Which nodes are you thinking are duplicates?

Can you go to the TEXT section of response and paste the output of your query?

The image I uploaded earlier has the duplicates. The green nodes (SocialUser) are duplicates. They have the same properties but the graph ids are different

Can you please paste the text to see complete values. They are obscured in the image.

I deleted the output but i'll run it again

The query runs when I use a mobile or a desktop client. When I run it from my desktop it works without creating any duplicates but when I run it from the mobile then the duplicate occurs. Will anyone happen to know why this problem is occurring?

I'm not sure what you mean by mobile client? Can you please elaborate?

I meant a mobile device. But I just realized it's a major issue. I think running a MERGE on a node that doesn't yet exist in the graph can sometimes create duplicates. Or that isn't the case?

Yes it is possible. If you are running requests in multiple threads the MERGE can create duplicate nodes, when a node with that key doesn't exst. If this is not required, then you should either create a constraint or run it in a single thread.


1 Like