node-neo4j
node-neo4j copied to clipboard
updateNode should update not replace node's all properties
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.
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
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?