Skip to main content

AROP

Aggregate values in an inclusive array range.
1 min read

SUM, MIN, and MAX aggregate numeric values. AND, OR, and XOR fold values as 64-bit integers, truncating fractions. These operations skip non-numeric values. USED counts occupied slots. MATCH counts values equal to the supplied value.

Arguments#

keystringrequired#

The array key.

startnumber | stringrequired#

The first index of the inclusive range.

endnumber | stringrequired#

The last index of the inclusive range.

operationArOpOperation<TData>required#

The reduction to apply. See the operations below.

Pass "SUM", "MIN", "MAX", "AND", "OR", "XOR", or "USED" (lowercase is also accepted). For equality matching, pass { match: value } as the operation.

Response#

number | nullrequired

The numeric aggregate, or null (TypeScript) / None (Python) if no values can be used. USED and MATCH return zero for an empty range.

See the server command reference for protocol details.

Was this page helpful?