apoc.agg.product

Details

Syntax

apoc.agg.product(value)

Description

Returns the product of all non-null INTEGER and FLOAT values in the collection.

Arguments

Name

Type

Description

value

INTEGER | FLOAT

A value to be multiplied in the aggregate.

Returns

INTEGER | FLOAT

Usage examples

The following examples computes the product of numeric values in a list using both APOC and Cypher:

apoc.agg.product
UNWIND range(1,10) AS values
RETURN apoc.agg.product(values) AS result,
       1*2*3*4*5*6*7*8*9*10 AS manualEquivalent
Using Cypher’s reduce()
WITH range(1,10) AS values
RETURN reduce(x = 1, i IN values | x * i) AS result,
       1*2*3*4*5*6*7*8*9*10 AS manualEquivalent
Results
result manualEquivalent

3628800

3628800