this might be a basic question, but I cannot find the docs anywhere for this for the life of me. I tried https://tinkerpop.apache.org/docs/current/reference/#terminal-steps but for the terminal steps it seems to be only for gremlin console.
I'm running gremlin in javascript on an AWS lambda connecting to neptune. What do the things next() returns mean?
I call something like
const addedItem = await g.addV('student').property('name', 'Jeffery').property('GPA', 4.0).next();
console.log('added: ' + mapToStr(addedItem));
this outputs
added: {"value":{"id":"24c52605-36ce-3194-72d6-46f5265ac59e","label":"student"},"done":false}
Value is self explanatory (even though if I want the full item back I have to add .valueMap()), what does "done" mean? Does it mean neptune has not yet added the node yet? I have noticed sometimes when I run my script back-to-back I get
Failed to complete Insert operation for a VertexProperty due to conflicting concurrent operations. Please retry. 0 transactions are currently rolling back.
I believe that the next()
being called is the JavaScript method, not the Gremlin step (https://www.geeksforgeeks.org/javascript-generator-next-method/) where the done
field represents the fact that the iterator has additional items that can be returned. Usually when I work in JavaScript I use the toList()
gremlin step as the terminal step which returns all values as a list instead of as an iterator like the next()
step. Unless you are returning many values, you will not see any noticeable performance difference