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

Working with transactions

Open StarpTech opened this issue 10 years ago • 0 comments

Hi, it should be possible to get statements from the actions (insertNode..) to use your transaction api effectively.

e.g

//Insert node and get the statement
var statement = db.insertNode({
    name: 'Darth Vader',
    sex: 'male'
},function(err, node){
    if(err) throw err;

    // Output node properties.
    console.log(node.data);

    // Output node id.
    console.log(node._id);
});
//Begin transaction
var id = db.beginTransaction(callback, statement);
db.commitTransaction(id, callback);

//...or similiar

StarpTech avatar Feb 14 '15 22:02 StarpTech