Skip to main content

$find

The $find operator finds the first element in an array that matches a provided condition.

Input

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

Output

  • The first element that satisfies the condition, or null if no element matches

Examples

Find Even Number

Result: 2

Find Object by Property

Result: {"name": "Bob", "age": 30}