- Reference >
- Operators >
- Aggregation Pipeline Operators >
- $isArray (aggregation)
$isArray (aggregation)¶
On this page
Definition¶
Behavior¶
The <expression>
can be any valid expression. For more information on expressions, see
Expressions.
Example | Results |
---|---|
{ $isArray: [ "hello" ] } |
false |
{ $isArray: [ [ "hello", "world" ] ] } |
true |
Example¶
A collection named warehouses
contains the following documents:
The following example checks if the instock
and the ordered
fields are arrays before concatenating the two:
See also