$$coalesce / $$first
Returns the first non-null value.
tip
Coalesce can also be referred to as $$first
instead of $$coealesce
Usage​
{
"$$coalesce": [ /* values */ ]
}
"$$coalesce:{input}"
Returns​
Same as first non-null value
Arguments​
Argument | Type | Values | Required / Default Value | Description |
---|---|---|---|---|
Primary | array | Yes | Array of elements (may include nulls) |
Examples​
Input
Definition
Output
[null, null, 1, null, 2]
{
"$$coalesce": "$"
}
1
null
{
"$$coalesce": [
"$",
"default"
]
}
"default"