# Aggregate Array | ARRAY_AGGREGATE

### Syntax

`ARRAY_AGGREGATE( [value], [aggregation] )`

### Parameters

value

The ARRAY being aggregated.
It should be an ARRAY of MAP / OBJECT records.

aggregation

A MAP that defines how the VALUE is to be aggregated.
Each key in the MAP should be a path into the entries in the VALUE array.
Each value in the map must be an aggregation operator.
The valid operators are as follows:

**sum**: Get the sum of the values in the entries.**average**: Get the average of the values in the entries.**first**: Get the value in the first entry.**last**: Get the value in the last entry.**max**: Get the largest of the values in the entries.**min**: Get the smallest of the values in the entries.**push**: Collect the items in each of the entries in an ARRAY.

### Return Value

A single MAP / OBJECT with the results of the aggregation performed on the VALUE.### Description

Reduce an ARRAY of OBJECT / MAP records into a single OBJECT according to a provided aggregation operation.### Examples

```
# VALUES is [["a" => 1, "b" => 2], ["a" => 3, "b" => 4], ["a" => 5, "b" => 6]]
ARRAY_AGGREGATE(VALUE, ["a" => "sum", "b" => "average"]) # returns ["a" => 9, "b" => 4]
```

```
# VALUES is [["a" => 1, "b" => 2], ["a" => 3, "b" => 4], ["a" => 5, "b" => 6]]
ARRAY_AGGREGATE(VALUE, ["a" => "first", "b" => "last"]) # returns ["a" => 1, "b" => 6]
```

```
# VALUES is [["a" => 1, "b" => 2], ["a" => 3, "b" => 4], ["a" => 5, "b" => 6]]
ARRAY_AGGREGATE(VALUE, ["a" => "max", "b" => "min"]) # returns ["a" => 5, "b" => 2]
```

```
# VALUES is [["a" => 1, "b" => 2], ["a" => 3, "b" => 4], ["a" => 5, "b" => 6]]
ARRAY_AGGREGATE(VALUE, ["a" => "push"]) # returns ["a" => [1, 3, 5]]
```

```
# values is [["a" => ["b" => 1]], ["a" => ["b" => 4]], ["a" => ["b" => 10]]]
ARRAY_AGGREGATE(VALUE, ["a.b" => "average"]) # returns ["a" => ["b" => 5]]
```