philippkueng / node-neo4j

Neo4j REST API wrapper for Node.js
MIT License
211 stars 44 forks source link

updateNode should update not replace node's all properties #51

Open rajaraodv opened 9 years ago

rajaraodv commented 9 years ago

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.

philippkueng commented 9 years ago

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

rajaraodv commented 9 years ago

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?