$isArray

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Array aggregation expressions

What it does

Returns true if the expression resolves to an array.

Syntax

{$isArray: expression}

Use case

Guard against inconsistent imported data.

$isArray: practical example
{ $project: { isArray: { $isArray: "$tags" } } }
💡 Explanation Returns true if the expression resolves to an array. When to use it Guard against inconsistent imported data.
Key Takeaways
  • Returns true if the expression resolves to an array.
  • Typical use: Guard against inconsistent imported data.