...

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

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

     1{
     2  "runOn": [
     3    {
     4      "minServerVersion": "7.0.0",
     5      "topology": [
     6        "replicaset",
     7        "sharded",
     8        "load-balanced"
     9      ]
    10    }
    11  ],
    12  "database_name": "default",
    13  "collection_name": "default",
    14  "data": [],
    15  "tests": [
    16    {
    17      "description": "create with a validator on an unencrypted field is OK",
    18      "clientOptions": {
    19        "autoEncryptOpts": {
    20          "kmsProviders": {
    21            "local": {
    22              "key": {
    23                "$binary": {
    24                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
    25                  "subType": "00"
    26                }
    27              }
    28            }
    29          },
    30          "encryptedFieldsMap": {
    31            "default.encryptedCollection": {
    32              "fields": [
    33                {
    34                  "keyId": {
    35                    "$binary": {
    36                      "base64": "EjRWeBI0mHYSNBI0VniQEg==",
    37                      "subType": "04"
    38                    }
    39                  },
    40                  "path": "encryptedIndexed",
    41                  "bsonType": "string",
    42                  "queries": {
    43                    "queryType": "equality",
    44                    "contention": {
    45                      "$numberLong": "0"
    46                    }
    47                  }
    48                },
    49                {
    50                  "keyId": {
    51                    "$binary": {
    52                      "base64": "q83vqxI0mHYSNBI0VniQEg==",
    53                      "subType": "04"
    54                    }
    55                  },
    56                  "path": "encryptedUnindexed",
    57                  "bsonType": "string"
    58                }
    59              ]
    60            }
    61          }
    62        }
    63      },
    64      "operations": [
    65        {
    66          "name": "dropCollection",
    67          "object": "database",
    68          "arguments": {
    69            "collection": "encryptedCollection"
    70          }
    71        },
    72        {
    73          "name": "createCollection",
    74          "object": "database",
    75          "arguments": {
    76            "collection": "encryptedCollection",
    77            "validator": {
    78              "unencrypted_string": "foo"
    79            }
    80          }
    81        },
    82        {
    83          "name": "assertCollectionExists",
    84          "object": "testRunner",
    85          "arguments": {
    86            "database": "default",
    87            "collection": "encryptedCollection"
    88          }
    89        }
    90      ]
    91    },
    92    {
    93      "description": "create with a validator on an encrypted field is an error",
    94      "clientOptions": {
    95        "autoEncryptOpts": {
    96          "kmsProviders": {
    97            "local": {
    98              "key": {
    99                "$binary": {
   100                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   101                  "subType": "00"
   102                }
   103              }
   104            }
   105          },
   106          "encryptedFieldsMap": {
   107            "default.encryptedCollection": {
   108              "fields": [
   109                {
   110                  "keyId": {
   111                    "$binary": {
   112                      "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   113                      "subType": "04"
   114                    }
   115                  },
   116                  "path": "encryptedIndexed",
   117                  "bsonType": "string",
   118                  "queries": {
   119                    "queryType": "equality",
   120                    "contention": {
   121                      "$numberLong": "0"
   122                    }
   123                  }
   124                },
   125                {
   126                  "keyId": {
   127                    "$binary": {
   128                      "base64": "q83vqxI0mHYSNBI0VniQEg==",
   129                      "subType": "04"
   130                    }
   131                  },
   132                  "path": "encryptedUnindexed",
   133                  "bsonType": "string"
   134                }
   135              ]
   136            }
   137          }
   138        }
   139      },
   140      "operations": [
   141        {
   142          "name": "dropCollection",
   143          "object": "database",
   144          "arguments": {
   145            "collection": "encryptedCollection"
   146          }
   147        },
   148        {
   149          "name": "createCollection",
   150          "object": "database",
   151          "arguments": {
   152            "collection": "encryptedCollection",
   153            "validator": {
   154              "encryptedIndexed": "foo"
   155            }
   156          },
   157          "result": {
   158            "errorContains": "Comparison to encrypted fields not supported"
   159          }
   160        }
   161      ]
   162    },
   163    {
   164      "description": "collMod with a validator on an unencrypted field is OK",
   165      "clientOptions": {
   166        "autoEncryptOpts": {
   167          "kmsProviders": {
   168            "local": {
   169              "key": {
   170                "$binary": {
   171                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   172                  "subType": "00"
   173                }
   174              }
   175            }
   176          },
   177          "encryptedFieldsMap": {
   178            "default.encryptedCollection": {
   179              "fields": [
   180                {
   181                  "keyId": {
   182                    "$binary": {
   183                      "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   184                      "subType": "04"
   185                    }
   186                  },
   187                  "path": "encryptedIndexed",
   188                  "bsonType": "string",
   189                  "queries": {
   190                    "queryType": "equality",
   191                    "contention": {
   192                      "$numberLong": "0"
   193                    }
   194                  }
   195                },
   196                {
   197                  "keyId": {
   198                    "$binary": {
   199                      "base64": "q83vqxI0mHYSNBI0VniQEg==",
   200                      "subType": "04"
   201                    }
   202                  },
   203                  "path": "encryptedUnindexed",
   204                  "bsonType": "string"
   205                }
   206              ]
   207            }
   208          }
   209        }
   210      },
   211      "operations": [
   212        {
   213          "name": "dropCollection",
   214          "object": "database",
   215          "arguments": {
   216            "collection": "encryptedCollection"
   217          }
   218        },
   219        {
   220          "name": "createCollection",
   221          "object": "database",
   222          "arguments": {
   223            "collection": "encryptedCollection"
   224          }
   225        },
   226        {
   227          "name": "runCommand",
   228          "object": "database",
   229          "arguments": {
   230            "command": {
   231              "collMod": "encryptedCollection",
   232              "validator": {
   233                "unencrypted_string": "foo"
   234              }
   235            }
   236          }
   237        }
   238      ]
   239    },
   240    {
   241      "description": "collMod with a validator on an encrypted field is an error",
   242      "clientOptions": {
   243        "autoEncryptOpts": {
   244          "kmsProviders": {
   245            "local": {
   246              "key": {
   247                "$binary": {
   248                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   249                  "subType": "00"
   250                }
   251              }
   252            }
   253          },
   254          "encryptedFieldsMap": {
   255            "default.encryptedCollection": {
   256              "fields": [
   257                {
   258                  "keyId": {
   259                    "$binary": {
   260                      "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   261                      "subType": "04"
   262                    }
   263                  },
   264                  "path": "encryptedIndexed",
   265                  "bsonType": "string",
   266                  "queries": {
   267                    "queryType": "equality",
   268                    "contention": {
   269                      "$numberLong": "0"
   270                    }
   271                  }
   272                },
   273                {
   274                  "keyId": {
   275                    "$binary": {
   276                      "base64": "q83vqxI0mHYSNBI0VniQEg==",
   277                      "subType": "04"
   278                    }
   279                  },
   280                  "path": "encryptedUnindexed",
   281                  "bsonType": "string"
   282                }
   283              ]
   284            }
   285          }
   286        }
   287      },
   288      "operations": [
   289        {
   290          "name": "dropCollection",
   291          "object": "database",
   292          "arguments": {
   293            "collection": "encryptedCollection"
   294          }
   295        },
   296        {
   297          "name": "createCollection",
   298          "object": "database",
   299          "arguments": {
   300            "collection": "encryptedCollection"
   301          }
   302        },
   303        {
   304          "name": "runCommand",
   305          "object": "database",
   306          "arguments": {
   307            "command": {
   308              "collMod": "encryptedCollection",
   309              "validator": {
   310                "encryptedIndexed": "foo"
   311              }
   312            }
   313          },
   314          "result": {
   315            "errorContains": "Comparison to encrypted fields not supported"
   316          }
   317        }
   318      ]
   319    },
   320    {
   321      "description": "createIndexes with a partialFilterExpression on an unencrypted field is OK",
   322      "clientOptions": {
   323        "autoEncryptOpts": {
   324          "kmsProviders": {
   325            "local": {
   326              "key": {
   327                "$binary": {
   328                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   329                  "subType": "00"
   330                }
   331              }
   332            }
   333          },
   334          "encryptedFieldsMap": {
   335            "default.encryptedCollection": {
   336              "fields": [
   337                {
   338                  "keyId": {
   339                    "$binary": {
   340                      "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   341                      "subType": "04"
   342                    }
   343                  },
   344                  "path": "encryptedIndexed",
   345                  "bsonType": "string",
   346                  "queries": {
   347                    "queryType": "equality",
   348                    "contention": {
   349                      "$numberLong": "0"
   350                    }
   351                  }
   352                },
   353                {
   354                  "keyId": {
   355                    "$binary": {
   356                      "base64": "q83vqxI0mHYSNBI0VniQEg==",
   357                      "subType": "04"
   358                    }
   359                  },
   360                  "path": "encryptedUnindexed",
   361                  "bsonType": "string"
   362                }
   363              ]
   364            }
   365          }
   366        }
   367      },
   368      "operations": [
   369        {
   370          "name": "dropCollection",
   371          "object": "database",
   372          "arguments": {
   373            "collection": "encryptedCollection"
   374          }
   375        },
   376        {
   377          "name": "createCollection",
   378          "object": "database",
   379          "arguments": {
   380            "collection": "encryptedCollection"
   381          }
   382        },
   383        {
   384          "name": "runCommand",
   385          "object": "database",
   386          "arguments": {
   387            "command": {
   388              "createIndexes": "encryptedCollection",
   389              "indexes": [
   390                {
   391                  "name": "name",
   392                  "key": {
   393                    "name": 1
   394                  },
   395                  "partialFilterExpression": {
   396                    "unencrypted_string": "foo"
   397                  }
   398                }
   399              ]
   400            }
   401          }
   402        },
   403        {
   404          "name": "assertIndexExists",
   405          "object": "testRunner",
   406          "arguments": {
   407            "database": "default",
   408            "collection": "encryptedCollection",
   409            "index": "name"
   410          }
   411        }
   412      ]
   413    },
   414    {
   415      "description": "createIndexes with a partialFilterExpression on an encrypted field is an error",
   416      "clientOptions": {
   417        "autoEncryptOpts": {
   418          "kmsProviders": {
   419            "local": {
   420              "key": {
   421                "$binary": {
   422                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   423                  "subType": "00"
   424                }
   425              }
   426            }
   427          },
   428          "encryptedFieldsMap": {
   429            "default.encryptedCollection": {
   430              "fields": [
   431                {
   432                  "keyId": {
   433                    "$binary": {
   434                      "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   435                      "subType": "04"
   436                    }
   437                  },
   438                  "path": "encryptedIndexed",
   439                  "bsonType": "string",
   440                  "queries": {
   441                    "queryType": "equality",
   442                    "contention": {
   443                      "$numberLong": "0"
   444                    }
   445                  }
   446                },
   447                {
   448                  "keyId": {
   449                    "$binary": {
   450                      "base64": "q83vqxI0mHYSNBI0VniQEg==",
   451                      "subType": "04"
   452                    }
   453                  },
   454                  "path": "encryptedUnindexed",
   455                  "bsonType": "string"
   456                }
   457              ]
   458            }
   459          }
   460        }
   461      },
   462      "operations": [
   463        {
   464          "name": "dropCollection",
   465          "object": "database",
   466          "arguments": {
   467            "collection": "encryptedCollection"
   468          }
   469        },
   470        {
   471          "name": "createCollection",
   472          "object": "database",
   473          "arguments": {
   474            "collection": "encryptedCollection"
   475          }
   476        },
   477        {
   478          "name": "runCommand",
   479          "object": "database",
   480          "arguments": {
   481            "command": {
   482              "createIndexes": "encryptedCollection",
   483              "indexes": [
   484                {
   485                  "name": "name",
   486                  "key": {
   487                    "name": 1
   488                  },
   489                  "partialFilterExpression": {
   490                    "encryptedIndexed": "foo"
   491                  }
   492                }
   493              ]
   494            }
   495          },
   496          "result": {
   497            "errorContains": "Comparison to encrypted fields not supported"
   498          }
   499        }
   500      ]
   501    }
   502  ]
   503}

View as plain text