cancel
Showing results for 
Search instead for 
Did you mean: 

Remove/Change secondary labels with Neo4j-OGM

Martin
Node Link

Hi again,
I've been having some trouble with changing the labels for my nodes with the neo4j-ogm framework. While using the @Labels annotation for a collection of labels I can load labels from the graph just fine, as well as store new labels, but if I try to remove a label the node is unchanged. I think I might be using the ogm framework wrong. Is there something else I should do if I need to change labels for node?
For instance if I have a node in the graph (myNode:A:B { id: "myId" }). This code below does not work:

@NodeEntity
public class A {
  @Id String id;
  @Labels List<String> labels;
}
---
A a = session.load(A.class, "myId");
a.labels.remove("B");
session.save(a);

The node will still have the label :B attached to it

2 REPLIES 2

Thanks for reporting this. We track this here:

I agree, looks like bug.

Just to let you know: This is fixed and will be released in 3.1.6 and 3.2.

Thank you for your feedback.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.