countDistinct.php
Table of Contents
Functions
- countDistinct() : string
- Count the number of distinct elements in an array.
Functions
countDistinct()
Count the number of distinct elements in an array.
countDistinct(mixed $anyArray) : string
This helper wraps the ArangoDB AQL function COUNT_DISTINCT(anyArray) which
returns the number of unique elements in the given array, removing duplicates
before counting.
Example AQL usage:
COUNT_DISTINCT([1, 2, 3, 2, 1]) // returns 3 (unique elements: 1, 2, 3)
COUNT_DISTINCT(doc.tags) // returns number of unique tags
Parameters
- $anyArray : mixed
-
Array expression to count distinct elements of.
Tags
Return values
string —The formatted AQL expression.