const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));const tx = g.tx(); // create a Transaction// spawn a new GraphTraversalSource binding all traversals established from it to txconst gtx = tx.begin();// execute traversals using gtx occur within the scope of the transaction held by tx. the// tx is closed after calls to commit or rollback and cannot be re-used. simply spawn a// new Transaction from g.tx() to create a new one as needed. the g context remains// accessible through all this as a sessionless connection.Promise.all([ gtx.addV("person").property("name", "jorge").iterate(), gtx.addV("person").property("name", "josh").iterate()]).then(() => { return tx.commit();}).catch(() => { return tx.rollback();});
const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin'));const tx = g.tx(); // create a Transaction// spawn a new GraphTraversalSource binding all traversals established from it to txconst gtx = tx.begin();// execute traversals using gtx occur within the scope of the transaction held by tx. the// tx is closed after calls to commit or rollback and cannot be re-used. simply spawn a// new Transaction from g.tx() to create a new one as needed. the g context remains// accessible through all this as a sessionless connection.Promise.all([ gtx.addV("person").property("name", "jorge").iterate(), gtx.addV("person").property("name", "josh").iterate()]).then(() => { return tx.commit();}).catch(() => { return tx.rollback();});
Solution
right, there are no any guaranties with
Promise.all
Promise.all
if for some reason the insertion order is important, then you need to call sequentially