{
  "runOn": [
    {
      "minServerVersion": "8.0.0",
      "topology": [
        "replicaset",
        "sharded",
        "load-balanced"
      ]
    }
  ],
  "database_name": "default",
  "collection_name": "default",
  "data": [],
  "encrypted_fields": {
    "fields": [
      {
        "keyId": {
          "$binary": {
            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
            "subType": "04"
          }
        },
        "path": "encryptedInt",
        "bsonType": "int",
        "queries": {
          "queryType": "range",
          "contention": {
            "$numberLong": "0"
          },
          "trimFactor": {
            "$numberInt": "1"
          },
          "sparsity": {
            "$numberLong": "1"
          },
          "min": {
            "$numberInt": "0"
          },
          "max": {
            "$numberInt": "200"
          }
        }
      }
    ]
  },
  "key_vault_data": [
    {
      "_id": {
        "$binary": {
          "base64": "EjRWeBI0mHYSNBI0VniQEg==",
          "subType": "04"
        }
      },
      "keyMaterial": {
        "$binary": {
          "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==",
          "subType": "00"
        }
      },
      "creationDate": {
        "$date": {
          "$numberLong": "1648914851981"
        }
      },
      "updateDate": {
        "$date": {
          "$numberLong": "1648914851981"
        }
      },
      "status": {
        "$numberInt": "0"
      },
      "masterKey": {
        "provider": "local"
      }
    }
  ],
  "tests": [
    {
      "description": "FLE2 Range Int. FindOneAndUpdate.",
      "clientOptions": {
        "autoEncryptOpts": {
          "kmsProviders": {
            "local": {
              "key": {
                "$binary": {
                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
                  "subType": "00"
                }
              }
            }
          }
        }
      },
      "operations": [
        {
          "name": "insertOne",
          "arguments": {
            "document": {
              "_id": 0,
              "encryptedInt": {
                "$numberInt": "0"
              }
            }
          }
        },
        {
          "name": "insertOne",
          "arguments": {
            "document": {
              "_id": 1,
              "encryptedInt": {
                "$numberInt": "1"
              }
            }
          }
        },
        {
          "name": "findOneAndUpdate",
          "arguments": {
            "filter": {
              "encryptedInt": {
                "$gt": {
                  "$numberInt": "0"
                }
              }
            },
            "update": {
              "$set": {
                "encryptedInt": {
                  "$numberInt": "2"
                }
              }
            },
            "returnDocument": "Before"
          },
          "result": {
            "_id": 1,
            "encryptedInt": {
              "$numberInt": "1"
            }
          }
        }
      ],
      "expectations": [
        {
          "command_started_event": {
            "command": {
              "listCollections": 1,
              "filter": {
                "name": "default"
              }
            },
            "command_name": "listCollections"
          }
        },
        {
          "command_started_event": {
            "command": {
              "find": "datakeys",
              "filter": {
                "$or": [
                  {
                    "_id": {
                      "$in": [
                        {
                          "$binary": {
                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
                            "subType": "04"
                          }
                        }
                      ]
                    }
                  },
                  {
                    "keyAltNames": {
                      "$in": []
                    }
                  }
                ]
              },
              "$db": "keyvault",
              "readConcern": {
                "level": "majority"
              }
            },
            "command_name": "find"
          }
        },
        {
          "command_started_event": {
            "command": {
              "insert": "default",
              "documents": [
                {
                  "_id": 0,
                  "encryptedInt": {
                    "$$type": "binData"
                  }
                }
              ],
              "ordered": true,
              "encryptionInformation": {
                "type": 1,
                "schema": {
                  "default.default": {
                    "escCollection": "enxcol_.default.esc",
                    "ecocCollection": "enxcol_.default.ecoc",
                    "fields": [
                      {
                        "keyId": {
                          "$binary": {
                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
                            "subType": "04"
                          }
                        },
                        "path": "encryptedInt",
                        "bsonType": "int",
                        "queries": {
                          "queryType": "range",
                          "contention": {
                            "$numberLong": "0"
                          },
                          "trimFactor": {
                            "$numberInt": "1"
                          },
                          "sparsity": {
                            "$numberLong": "1"
                          },
                          "min": {
                            "$numberInt": "0"
                          },
                          "max": {
                            "$numberInt": "200"
                          }
                        }
                      }
                    ]
                  }
                }
              }
            },
            "command_name": "insert"
          }
        },
        {
          "command_started_event": {
            "command": {
              "insert": "default",
              "documents": [
                {
                  "_id": 1,
                  "encryptedInt": {
                    "$$type": "binData"
                  }
                }
              ],
              "ordered": true,
              "encryptionInformation": {
                "type": 1,
                "schema": {
                  "default.default": {
                    "escCollection": "enxcol_.default.esc",
                    "ecocCollection": "enxcol_.default.ecoc",
                    "fields": [
                      {
                        "keyId": {
                          "$binary": {
                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
                            "subType": "04"
                          }
                        },
                        "path": "encryptedInt",
                        "bsonType": "int",
                        "queries": {
                          "queryType": "range",
                          "contention": {
                            "$numberLong": "0"
                          },
                          "trimFactor": {
                            "$numberInt": "1"
                          },
                          "sparsity": {
                            "$numberLong": "1"
                          },
                          "min": {
                            "$numberInt": "0"
                          },
                          "max": {
                            "$numberInt": "200"
                          }
                        }
                      }
                    ]
                  }
                }
              }
            },
            "command_name": "insert"
          }
        },
        {
          "command_started_event": {
            "command": {
              "findAndModify": "default",
              "query": {
                "encryptedInt": {
                  "$gt": {
                    "$binary": {
                      "base64": "DW0FAAADcGF5bG9hZAAZBQAABGcABQUAAAMwAH0AAAAFZAAgAAAAALGGQ/CRD+pGLD53BZzWcCcYbuGLVEyjzXIx7b+ux/q2BXMAIAAAAACOC6mXEZL27P9hethZbtKYsTXKK+FpgQ9Axxmn9N/cCwVsACAAAAAA+MFEd8XfZSpbXKqqPC2L3TEFswkaG5Ff6aSgf8p+XVIAAzEAfQAAAAVkACAAAAAAtL3QIvnZqCF72eS6lKr8ilff7R6kiNklokiTuaU5wNsFcwAgAAAAAEtqr3/X731VB+VrbFcY8ZrJKRo2E0Fd+C8L0EMNcvcCBWwAIAAAAABNPhSriux8W8qbwnhCczE3IzlhNEnGDpUwTFDZSL+eYQADMgB9AAAABW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zACAAAAAAOLypVKNxf/wR1G8OZjUUsTQzDYeNNhhITxGMSp7euS4FbAAgAAAAAA9EsxoV1B2DcQ1NJRwuxXnvVR+vkD0wbbDYEI/zFEnDAAM5AH0AAAAFZAAgAAAAAEocREw1L0g+roFUchJI2Yd0M0ME2bnErNUYnpyJP1SqBXMAIAAAAAAcE2/JK/8MoSeOchIuAkKh1X3ImoA7p8ujAZIfvIDo6QVsACAAAAAA+W0+zgLr85/PD7P9a94wk6MgNgrizx/XU9aCxAkp1IwAABJjbQAAAAAAAAAAAAAQcGF5bG9hZElkAAAAAAAQZmlyc3RPcGVyYXRvcgABAAAAEnNwAAEAAAAAAAAAEHRmAAEAAAAQbW4AAAAAABBteADIAAAAAA==",
                      "subType": "06"
                    }
                  }
                }
              },
              "update": {
                "$set": {
                  "encryptedInt": {
                    "$$type": "binData"
                  }
                }
              },
              "encryptionInformation": {
                "type": 1,
                "schema": {
                  "default.default": {
                    "escCollection": "enxcol_.default.esc",
                    "ecocCollection": "enxcol_.default.ecoc",
                    "fields": [
                      {
                        "keyId": {
                          "$binary": {
                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
                            "subType": "04"
                          }
                        },
                        "path": "encryptedInt",
                        "bsonType": "int",
                        "queries": {
                          "queryType": "range",
                          "contention": {
                            "$numberLong": "0"
                          },
                          "trimFactor": {
                            "$numberInt": "1"
                          },
                          "sparsity": {
                            "$numberLong": "1"
                          },
                          "min": {
                            "$numberInt": "0"
                          },
                          "max": {
                            "$numberInt": "200"
                          }
                        }
                      }
                    ]
                  }
                }
              }
            },
            "command_name": "findAndModify"
          }
        }
      ],
      "outcome": {
        "collection": {
          "data": [
            {
              "_id": 0,
              "encryptedInt": {
                "$$type": "binData"
              },
              "__safeContent__": [
                {
                  "$binary": {
                    "base64": "RjBYT2h3ZAoHxhf8DU6/dFbDkEBZp0IxREcsRTu2MXs=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "x7GR49EN0t3WXQDihkrbonK7qNIBYC87tpL/XEUyIYc=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "JfYUqWF+OoGjiYkRI4L5iPlF+T1Eleul7Fki22jp4Qc=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "q1RyGfIgsaQHoZFRw+DD28V26rN5hweApPLwExncvT8=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "L2PFeKGvLS6C+DLudR6fGlBq3ERPvjWvRyNRIA2HVb0=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "CWxaNqL3iP1yCixDkcmf9bmW3E5VeN8TJkg1jJe528s=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "+vC6araOEo+fpW7PSIP40/EnzBCj1d2N10Jr3rrXJJM=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "6SV63Mf51Z6A6p2X3rCnJKCu6ku3Oeb45mBYbz+IoAo=",
                    "subType": "00"
                  }
                }
              ]
            },
            {
              "_id": 1,
              "encryptedInt": {
                "$$type": "binData"
              },
              "__safeContent__": [
                {
                  "$binary": {
                    "base64": "hyDcE6QQjPrYJaIS/n7evEZFYcm31Tj89CpEYGF45cI=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "F08nMDWDZc+DbWM7XCEJNNCEYyinRmrvGP7EWhmp4is=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "cXH4688amcDc8kZOJq4UP8cE3R58Zl7e+Qo/1jyspps=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "uURBxvTp3FBCVkd+LPqyuY7d6rMW6SGIJQEPY/wtkZI=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "jG3hax1L3RBp9t38vUt53FsBxgr/+Si/vVISpAylYpE=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "kwtIW8MhH9Ky5xNjBx8gFA/SHh2YVphie7g5FGBzals=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "FHflwFuEMu4xX0ZApHi+pdlBH+oevAtXckCUb5Wv0xU=",
                    "subType": "00"
                  }
                },
                {
                  "$binary": {
                    "base64": "ty4cnzJdAlbQKnh7px3GEYjBnvO+jIOaKjoTRDtmh3M=",
                    "subType": "00"
                  }
                }
              ]
            }
          ]
        }
      }
    }
  ]
}
