0

Imagine that _key is a series which is always increasing, such as:

{
  _key:1,
  name: John,
  ...
},
{
  _key:2,
  name ...
},
...

I would like to get the maximum value of _key so I can include another element with a _key + 1 value.

I am using python-arango but I could collect the AQL query too.

Skully
  • 2,882
  • 3
  • 20
  • 31

1 Answers1

0

To get the largest numerical _key value of collection coll so far:

      FOR c IN coll
        COLLECT AGGREGATE maxk = MAX(c._key)
        RETURN {max_coll_key: TO_NUMBER(maxk)}
Tom Regner
  • 6,856
  • 4
  • 32
  • 47