I need to filter all documents by using multiple conditions.

```
{
    "name": "Maths",
    "excludeUserIds": [
        {
            "_id": 33,
            "groupIds": [
                "a",
                "b",
                "c"
            ]
        }
    ]
},
{
    "name": "Science",
    "excludeUserIds": [
        {
            "_id": 24,
            "groupIds": [
                "a",
                "x",
                "b"
            ]
        }
    ]
},
{
    "name": "Health",
    "excludeUserIds": []
},
{
    "name": "English",
    "excludeUserIds": [
        {
            "_id": 33,
            "groupIds": []
        }
    ]
}

```

The documents need to be returned if `excludeUserIds._id` not equal to given value **AND** `excludeUserIds.groupIds` are not in given array.
The mongo script I've written is

```
{
    "$match": {
      "excludeUserIds": {
        "$elemMatch": {
          "_id": {
            $ne: 33
          },
          "groupIds": {
            $nin: [
              "a"
            ]
          }
        }
      }
    }
  }

```

I expect this should return all document without **Maths**. But i doesn't work as I expected. Obviously I missed something. Thanks in advance. I created a [Mongo playground](https://mongoplayground.net/p/_diJrMPo5_Z)