title: ArangoDB copy Vertex and Edges to neighbors
body: <p>I'm trying to copy a vertex node and retain it's relationships in ArangoDB. I'm getting a "access after data-modification" error (1579). It doesn't like it when I iterate over the source node's edges and insert an edge copy within the loop. This makes sense but I'm struggling to figure out how to do what I'm wanting within a single transaction.</p>
  
  <pre><code>var query = arangojs.aqlQuery`
          let tmpNode = (FOR v IN vertices FILTER v._id == ${nodeId} RETURN v)[0]
          let nodeCopy = UNSET(tmpNode, '_id', '_key', '_rev')
          let nodeCopyId = (INSERT nodeCopy IN 'vertices' RETURN NEW._id)[0]
          FOR e IN GRAPH_EDGES('g', ${nodeId}, {'includeData': true, 'maxDepth': 1})
              let tmpEdge = UNSET(e, '_id', '_key', '_rev')
              let edgeCopy = MERGE(tmpEdge, {'_from': nodeCopyId})
              INSERT edgeCopy IN 'edges'
  `;
  </code></pre>