cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

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

2X_1_1bc7203969b7c37dfb421e2594b5af28ba27b5dc.png

Comments
12kunal34
Graph Fellow

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

szenyo
Node Clone

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

anthapu
Graph Fellow

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

anthapu
Graph Fellow

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?

anthapu
Graph Fellow

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?

anthapu
Graph Fellow

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.

Ravi

Version history
Last update:
‎01-03-2020 04:45 AM
Updated by:
Contributors