mergeE(): increment counter on match

Hi, is there an easy way to increment an existing edge property based on its current value using mergeE() in one single query? (e.g., counter += 1)

Something similar to this:
g.mergeE([(T.label):'called', (from): person1, (to):person2]).
  option(Merge.onCreate,['num_calls': 1]).
  option(Merge.onMatch,['num_calls': X+1])

where X is the current value of edge propery num_calls.
Solution
gremlin> g.mergeE([(Direction.from):44,(Direction.to):8]).valueMap(true)
==>[id:5062,label:route,dist:549] 

and then
gremlin>  g.mergeE([(Direction.from):44,(Direction.to):8]).
......1>     option(onMatch,property('dist',union(values('dist'), __.constant(1)).sum()).constant([:])).valueMap(true)   
==>[id:5062,label:route,dist:550] 
Was this page helpful?