Once you modify a collection, you cannot make further modifications to the same collection in the same query. However, you can update a different collection using the results from the first insert (such as using NEW._key to update/insert/remove a record in another collection).
For instance, this fails (two inserts into the same collection):
INSERT { value: 'baz' }
INTO a
LET an = NEW
INSERT { value: 'boo' }
INTO a
LET bn = NEW
RETURN { an, bn }
Returns:
ERROR: Query: AQL: access after data-modification by collection 'a' (while optimizing ast)
But this works just fine (results from insert into "a" are then inserted into "b"):
INSERT { value1: 'foo' }
INTO a
LET an = NEW
INSERT MERGE(NEW, { value2: 'bar' })
INTO b
LET bn = NEW
RETURN { an, bn }
RETURNS:
[{
"an": { "_id": "a/123", "_key": "123", "_rev": "_eA7tofW---", "value1": "foo" }, "bn": { "_id": "b/123", "_key": "123", "_rev": "_eA7tofW--_", "value1": "foo", "value2": "bar" }
}]