I'm trying create a relationship between 2 nodes A and B.
A potentially has several hundreds of connections and B may be a newly created node.
The way i'm doing it right now is by loading A with depth of 1, adding B as a child of A and then saving A with a depth of 1
Some example Groovy code,
def B = neo4jOperations.save(new B(), 0)
def A = neo4jOperations.load(A, idOfA, 1)
A.relationshipList().add(B)
neo4jOperations.save(A, 1) // This turns out to be slow since it is saving all the @EndNode of A, while it doesn't need to
This however, is VERY VERY slow due to neo4j loading and saving unnecessary nodes and relationships. I'm only interested to add one node i.e B to the existing relationships of A
Am I hitting an anti-pattern? Or is this the way its supposed to work? Is there a faster way i can do this?