...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-encryption/legacy/fle2v2-InsertFind-Indexed.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: "Insert and find 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: "123" }
    22      - name: find
    23        arguments:
    24          filter: { encryptedIndexed: "123" }
    25        result: [*doc0]
    26    expectations:
    27      - command_started_event:
    28          command:
    29            listCollections: 1
    30            filter:
    31              name: *collection_name
    32          command_name: listCollections
    33      - command_started_event:
    34          command:
    35            find: datakeys
    36            filter: {
    37                  "$or": [
    38                      {
    39                          "_id": {
    40                              "$in": [
    41                                {'$binary': {'base64': 'EjRWeBI0mHYSNBI0VniQEg==', 'subType': '04'}}
    42                              ]
    43                          }
    44                      },
    45                      {
    46                          "keyAltNames": {
    47                              "$in": []
    48                          }
    49                      }
    50                  ]
    51              }
    52            $db: keyvault
    53            readConcern: { level: "majority" }
    54          command_name: find
    55      - command_started_event:
    56          command:
    57            insert: *collection_name
    58            documents:
    59              - &doc0_encrypted { "_id": 1, "encryptedIndexed": { $$type: "binData" } }
    60            ordered: true
    61            encryptionInformation:
    62              type: 1
    63              schema:
    64                default.default:
    65                  # libmongocrypt applies escCollection and ecocCollection to outgoing command.
    66                  escCollection: "enxcol_.default.esc"
    67                  ecocCollection: "enxcol_.default.ecoc"
    68                  <<: *encrypted_fields
    69          command_name: insert
    70      - command_started_event:
    71          command:
    72            find: *collection_name
    73            filter: {
    74                "encryptedIndexed": {
    75                  "$eq": {
    76                    "$binary": {
    77                      "base64": "DIkAAAAFZAAgAAAAAPGmZcUzdE/FPILvRSyAScGvZparGI2y9rJ/vSBxgCujBXMAIAAAAACi1RjmndKqgnXy7xb22RzUbnZl1sOZRXPOC0KcJkAxmQVsACAAAAAApJtKPW4+o9B7gAynNLL26jtlB4+hq5TXResijcYet8USY20AAAAAAAAAAAAA",
    78                      "subType": "06"
    79                    }
    80                  }
    81                }
    82              }
    83            encryptionInformation:
    84              type: 1
    85              schema:
    86                default.default:
    87                  # libmongocrypt applies escCollection and ecocCollection to outgoing command.
    88                  escCollection: "enxcol_.default.esc"
    89                  ecocCollection: "enxcol_.default.ecoc"
    90                  <<: *encrypted_fields
    91          command_name: find
    92    outcome:
    93      collection:
    94        # Outcome is checked using a separate MongoClient without auto encryption.
    95        data:
    96          - { "_id": 1, "encryptedIndexed": { $$type: "binData" }, "__safeContent__": [{ "$binary" : { "base64" : "31eCYlbQoVboc5zwC8IoyJVSkag9PxREka8dkmbXJeY=", "subType" : "00" } }] }

View as plain text