node-neo4j icon indicating copy to clipboard operation
node-neo4j copied to clipboard

updateNode should update not replace node's all properties

Open rajaraodv opened this issue 10 years ago • 2 comments

I need to update a node's existing properties. I have node's id but, currently updateNode function replaces all properties of the node with the given properties. But I think it should really update/add properties.
describe('-> Replace an existing Node with a simple object, check if alias works', function () { it('should return true', function (done) { db.updateNode(node_id, { name: 'foobar2' }, function (err, result) { isTrue(err, result); done(); }); }); });

At least there should be "updateNodeProperties" function that takes "node_id" and properties and simply appends/replaces existing props to the existing node.

rajaraodv avatar Dec 27 '14 08:12 rajaraodv

Hi @rajaraodv

I'm sorry i've only had time now to check my emails. I'm currently on vacation and can't add that function. I think it's fairly trivial to implement using cypher queries. Send me a PR and i'll merge it on monday/tuesday.

Cheers Phil

philippkueng avatar Dec 27 '14 23:12 philippkueng

actually nm - I found another function "updateNodeById" (instead of updateNode) that did the job :+1:

BTW, I saw http://java.dzone.com/articles/10-caveats-neo4j-users-should not to use "_id" as they might get reused by a new node if that node is deleted. Is that true?

rajaraodv avatar Dec 28 '14 01:12 rajaraodv