jbmusso / grex

JavaScript graph database client for TinkerPop2 Rexster
MIT License
46 stars 12 forks source link

Transaction error when creating vertices with database generated id's #12

Closed jbmusso closed 11 years ago

jbmusso commented 11 years ago

Adding a vertex in a transaction fails with 0.2.0 (using latest Titan DB).

problem with Transaction
Could not complete transaction. Transaction has been rolled back.

Code is very close to the following:

var trxn = g.begin();
var v1, v2;

v1 = trxn.addVertex({name:'Frank'});
v2 = trxn.addVertex({name:'Luca'});
trxn.addEdge(v1, v2, 'knows', {since:"2003/06/01"})

// ...

trxn.commit().then(function(result){
    console.log("New vertices -> ", result);            
}, function(err) {
    console.error(err)
});

v1 (and v2) seems to be undefined

console.log v1
=> undefined
fattenap commented 11 years ago

I've hopefully rectified the issue. The fix is in the master branch and published to npm. Are you able to give it a try?

Thanks Frank

jbmusso commented 11 years ago

Fixed the issue, thanks! Works like a charm.

fattenap commented 11 years ago

Great!