Skip to content

$and

Returns true only when every expression in the array evaluates to a truthy value.

Syntax

{ "$and": [ <expression1>, <expression2>, ... ] }

Example

Input

{ "status": "active", "paymentReceived": true }

Stage

{
  "$project": {
    "canFulfill": {
      "$and": [
        { "$eq": ["$status", "active"] },
        "$paymentReceived"
      ]
    }
  }
}

Output

{ "canFulfill": true }