...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-encryption/legacy/fle2v2-InsertFind-Unindexed.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: "Insert and find FLE2 unindexed 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, encryptedUnindexed: "value123" }
    22      - name: find
    23        arguments:
    24          filter: { _id: 1 }
    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': 'q83vqxI0mHYSNBI0VniQEg==', '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, "encryptedUnindexed": { $$type: "binData" } }
    60            ordered: true
    61          command_name: insert
    62      - command_started_event:
    63          command:
    64            find: *collection_name
    65            filter: { "_id": { "$eq": 1 }}
    66          command_name: find
    67    outcome:
    68      collection:
    69        data:
    70          - { "_id": 1, "encryptedUnindexed": { $$type: "binData" } }
    71
    72  - description: "Query with an unindexed field fails"
    73    clientOptions:
    74      autoEncryptOpts:
    75        kmsProviders:
    76          local: {'key': {'$binary': {'base64': 'Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk', 'subType': '00'}}}
    77    operations:
    78      - name: insertOne
    79        arguments:
    80          document: { _id: 1, encryptedUnindexed: "value123" }
    81      - name: find
    82        arguments:
    83          filter: { encryptedUnindexed: "value123" }
    84        result:
    85          # Expected error message changed in https://github.com/10gen/mongo-enterprise-modules/commit/212b584d4f7a44bed41c826a180a4aff00923d7a#diff-5f12b55e8d5c52c2f62853ec595dc2c1e2e5cb4fdbf7a32739a8e3acb3c6f818
    86          # Before the message was "cannot query non-indexed fields with the randomized encryption algorithm"
    87          # After: "can only execute encrypted equality queries with an encrypted equality index"
    88          # Use a small common substring.
    89          errorContains: "encrypt"

View as plain text