...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-encryption/legacy/fle2v2-Delete.yml

Documentation: go.mongodb.org/mongo-driver/testdata/client-side-encryption/legacy

     1# Requires libmongocrypt 1.8.0.
     2runOn:
     3  - minServerVersion: "7.0.0"
     4    # Skip QEv2 (also referred to as FLE2v2) tests on Serverless. Unskip once Serverless enables the QEv2 protocol.
     5    # FLE 2 Encrypted collections are not supported on standalone.
     6    topology: [ "replicaset", "sharded", "load-balanced" ]
     7database_name: &database_name "default"
     8collection_name: &collection_name "default"
     9data: []
    10encrypted_fields: &encrypted_fields {'fields': [{'keyId': {'$binary': {'base64': 'EjRWeBI0mHYSNBI0VniQEg==', 'subType': '04'}}, 'path': 'encryptedIndexed', 'bsonType': 'string', 'queries': {'queryType': 'equality', 'contention': {'$numberLong': '0'}}}, {'keyId': {'$binary': {'base64': 'q83vqxI0mHYSNBI0VniQEg==', 'subType': '04'}}, 'path': 'encryptedUnindexed', 'bsonType': 'string'}]}
    11key_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'}} ]
    12tests:
    13  - description: "Delete can query an FLE2 indexed field"
    14    clientOptions:
    15      autoEncryptOpts:
    16        kmsProviders:
    17          local: {'key': {'$binary': {'base64': 'Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk', 'subType': '00'}}}
    18    operations:
    19      - name: insertOne
    20        arguments:
    21          document: &doc0 {"_id": 1, "encryptedIndexed": "value123" }
    22      - name: deleteOne
    23        arguments:
    24          filter: { "encryptedIndexed": "value123" }
    25        result:
    26          deletedCount: 1
    27    expectations:
    28      - command_started_event:
    29          command:
    30            listCollections: 1
    31            filter:
    32              name: *collection_name
    33          command_name: listCollections
    34      - command_started_event:
    35          command:
    36            find: datakeys
    37            filter: {
    38                  "$or": [
    39                      {
    40                          "_id": {
    41                              "$in": [
    42                                  {'$binary': {'base64': 'EjRWeBI0mHYSNBI0VniQEg==', 'subType': '04'}}
    43                              ]
    44                          }
    45                      },
    46                      {
    47                          "keyAltNames": {
    48                              "$in": []
    49                          }
    50                      }
    51                  ]
    52              }
    53            $db: keyvault
    54            readConcern: { level: "majority" }
    55          command_name: find
    56      - command_started_event:
    57          command:
    58            insert: *collection_name
    59            documents:
    60              - { "_id": 1, "encryptedIndexed": { $$type: "binData" } }
    61            ordered: true
    62            encryptionInformation:
    63                type: 1
    64                schema:
    65                  "default.default":
    66                    # libmongocrypt applies escCollection and ecocCollection to outgoing command.
    67                    escCollection: "enxcol_.default.esc"
    68                    ecocCollection: "enxcol_.default.ecoc"
    69                    <<: *encrypted_fields
    70          command_name: insert
    71      - command_started_event:
    72          command:
    73            delete: *collection_name
    74            deletes:
    75              - {
    76                  "q": {
    77                    "encryptedIndexed": { 
    78                      "$eq": {
    79                        "$binary": {
    80                            "base64": "DIkAAAAFZAAgAAAAAPtVteJQAlgb2YMa/+7YWH00sbQPyt7L6Rb8OwBdMmL2BXMAIAAAAAAd44hgVKnEnTFlwNVC14oyc9OZOTspeymusqkRQj57nAVsACAAAAAAaZ9s3G+4znfxStxeOZwcZy1OhzjMGc5hjmdMN+b/w6kSY20AAAAAAAAAAAAA",
    81                            "subType": "06"
    82                        }
    83                      }
    84                    }
    85                  },
    86                  "limit": 1
    87                }
    88            ordered: true
    89            encryptionInformation:
    90              type: 1
    91              schema:
    92                "default.default":
    93                  # libmongocrypt applies escCollection and ecocCollection to outgoing command.
    94                  escCollection: "enxcol_.default.esc"
    95                  ecocCollection: "enxcol_.default.ecoc"
    96                  <<: *encrypted_fields
    97          command_name: delete
    98    outcome:
    99      collection:
   100        data: []

View as plain text