MongoDB $size
Return the number of elements in an array.
Use it when the number of array entries matters. The input must resolve to an array, so account for missing or non-array values in production data.
Array expressions inspect or transform an array without creating a separate document for every element. These are supported in the playground for further practice.
Course use: Supported in the playground.
Example pipeline syntax
{ $size: "$items" }