max

ReQL command: max

Command syntax

sequence.max(field | function) → element
sequence.max(index=<indexname>) → element
r.max(sequence, field | function) → element
r.max(sequence, index=<indexname>) → element

Description

Finds the maximum element of a sequence.

The max command can be called with:

  • a field name, to return the element of the sequence with the largest value in that field;
  • an index (the primary key or a secondary index), to return the element of the sequence with the largest value in that index;
  • a function, to apply the function to every element within the sequence and return the element which returns the largest value from the function, ignoring any elements where the function produces a non-existenc