@Properties how do I delete an item from a node

(Clander) #1

I have this map setup:
private Map<String, String> alternateIds = new HashMap<>();

I want to be able to remove items and I thought I would be able to just do something simple like this:
public void setAlternateIds(Map<String, String> alternateIds) {
this.alternateIds = alternateIds;

But when I do that and my map on the actual node has more items in it. They stay on the node and are never wiped out. Any ideas on how I can delete an item from this?

(Clander) #2

I have also tried specifically removing all items from the map on my Entity and then saving. Still seems as those any item in the map stays in the graph

I can indeed do something like this in cypher tho

match (n) where n._id ="17fa667f-d004-4a52-8715-6ab2e779d5e9" remove n.alternateIds.ECRM_ID remove n.alternateIds.GLOBAL remove n.alternateIds.SOURCE_ID remove n.alternateIds.CLASSIC_NODE_ID return n

and remove each item manually

(Michael Simons) #4

I'm sad to say that this is probably a bug. I can reproduce the behavior with our issue template.

@gerrit.meier Please let us know what you think. If you agree that the properties should be deleted, I'll create a bug.

(Gerrit Meier) #5

Yes I have seen this behaviour before and I am 99% sure that this is a bug.

Related StackOverflow question: https://stackoverflow.com/questions/51374111/how-to-remove-the-properties-of-map-in-neo4j/51391308

(Michael Simons) #6


(Michael Simons) #7

Will be fixed in 3.2 and probably in 3.1.6 as well.