Skip to content

$in

Checks whether a value exists in an array.

Syntax

{ "$in": [ <expression>, <arrayExpression> ] }

Example

Input

{ "tags": ["beta", "feature-flag", "ios"] }

Stage

{ "$project": { "isIos": { "$in": ["ios", "$tags"] } } }

Output

{ "isIos": true }