How to check if one field is larger than another in a nested document

I want to check if one field in a document is larger than another field in that same document in order to check if it’s allowed to updated the document but i can’t figure out how. What i’m doing now is using an array filter like this: {"x.typeAmountUsed", bson.M{"$lt": "x.typeAmount"}}, but that doesn’t work.


  "eventTicketTypes": [
      "_id": {
        "$binary": {
          "base64": "eYvf+FABQQWim+7NUSCDOg==",
          "subType": "00"
      "typeActive": true,
      "typeAmount": 300,
      "typeAmountUsed": 5,
      "typeName": "Regular",
      "typeDescription": "A regular ticket",
      "typePrice": {
        "$numberDecimal": "30.99"
      "typeDeleted": false