...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-encryption/legacy/fle2v2-EncryptedFields-vs-EncryptedFieldsMap.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: {'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': 'q83vqxI0mHYSNBI0VniQEg==', 'subType': '04'}}, 'keyMaterial': {'$binary': {'base64': 'HBk9BWihXExNDvTp1lUxOuxuZK2Pe2ZdVdlsxPEBkiO1bS4mG5NNDsQ7zVxJAH8BtdOYp72Ku4Y3nwc0BUpIKsvAKX4eYXtlhv5zUQxWdeNFhg9qK7qb8nqhnnLeT0f25jFSqzWJoT379hfwDeu0bebJHr35QrJ8myZdPMTEDYF08QYQ48ShRBli0S+QzBHHAQiM2iJNr4svg2WR8JSeWQ==', 'subType': '00'}}, 'creationDate': {'$date': {'$numberLong': '1648914851981'}}, 'updateDate': {'$date': {'$numberLong': '1648914851981'}}, 'status': {'$numberInt': '0'}, 'masterKey': {'provider': 'local'}}]
    12tests:
    13  - description: "encryptedFieldsMap is preferred over remote encryptedFields"
    14    clientOptions:
    15      autoEncryptOpts:
    16        kmsProviders:
    17          local: {'key': {'$binary': {'base64': 'Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk', 'subType': '00'}}}
    18        encryptedFieldsMap: {
    19          "default.default": {
    20            "fields": []
    21          }
    22        }
    23    operations:
    24      # EncryptedFieldsMap overrides remote encryptedFields.
    25      # Automatic encryption does not occur on encryptedUnindexed. The value is validated on the server.
    26      - name: insertOne
    27        arguments:
    28          document: &doc0 {
    29            _id: 1,
    30            encryptedUnindexed: {
    31              "$binary": {
    32                "base64": "BqvN76sSNJh2EjQSNFZ4kBICTQaVZPWgXp41I7mPV1rLFTtw1tXzjcdSEyxpKKqujlko5TeizkB9hHQ009dVY1+fgIiDcefh+eQrm3CkhQ==",
    33                "subType": "06"
    34              }
    35            }
    36          }
    37      - name: find
    38        arguments:
    39          filter: { "_id": 1 }
    40        result: [{"_id": 1, "encryptedUnindexed": "value123" }]
    41    expectations:
    42      - command_started_event:
    43          command:
    44            insert: *collection_name
    45            documents:
    46              - *doc0
    47            ordered: true
    48          command_name: insert
    49      - command_started_event:
    50          command:
    51            find: *collection_name
    52            filter: { "_id": 1}
    53          command_name: find
    54      - command_started_event:
    55          command:
    56            find: datakeys
    57            filter: {
    58                  "$or": [
    59                      {
    60                          "_id": {
    61                              "$in": [
    62                                  {'$binary': {'base64': 'q83vqxI0mHYSNBI0VniQEg==', 'subType': '04'}}
    63                              ]
    64                          }
    65                      },
    66                      {
    67                          "keyAltNames": {
    68                              "$in": []
    69                          }
    70                      }
    71                  ]
    72              }
    73            $db: keyvault
    74            readConcern: { level: "majority" }
    75          command_name: find
    76    outcome:
    77      collection:
    78        data:
    79          - *doc0

View as plain text