Skip to main content

$filter

The $filter operator filters elements from an array based on a provided condition.

Input

  • An array containing an array to filter and a condition to evaluate for each element

Output

  • A new array containing only the elements that satisfy the condition

Examples

Filter Even Numbers

Result: [2, 4, 6]

Filter From Field

Result: An array of products with values greater than 100