0

I'm trying to use an $and within a $match and can't seem to get it correct. The syntax I'm using isn't correct.

{
"$match":
{
                "$expr": {
                  "$and": [
                    {
                      "$match": {
                        "contra": {
                          "$exists": true
                        }
                      }
                    }
                    ,
                    {
                      "$match": {
                        "$expr": {
                          "$eq": [
                            "$isActivation", true
                          ]
                        }
                      }
                    }
                  ]
                }
}
}
Avant1234
  • 5
  • 3

1 Answers1

1

Should be as simple as this:

{
    "$match": {
        "contractId": { "$exists": true },
        "isActive": true
    }
}
Dheemanth Bhat
  • 4,269
  • 2
  • 21
  • 40