...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-encryption/legacy/fle2v2-Update.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  "encrypted_fields": {
    16    "fields": [
    17      {
    18        "keyId": {
    19          "$binary": {
    20            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
    21            "subType": "04"
    22          }
    23        },
    24        "path": "encryptedIndexed",
    25        "bsonType": "string",
    26        "queries": {
    27          "queryType": "equality",
    28          "contention": {
    29            "$numberLong": "0"
    30          }
    31        }
    32      },
    33      {
    34        "keyId": {
    35          "$binary": {
    36            "base64": "q83vqxI0mHYSNBI0VniQEg==",
    37            "subType": "04"
    38          }
    39        },
    40        "path": "encryptedUnindexed",
    41        "bsonType": "string"
    42      }
    43    ]
    44  },
    45  "key_vault_data": [
    46    {
    47      "_id": {
    48        "$binary": {
    49          "base64": "EjRWeBI0mHYSNBI0VniQEg==",
    50          "subType": "04"
    51        }
    52      },
    53      "keyMaterial": {
    54        "$binary": {
    55          "base64": "sHe0kz57YW7v8g9VP9sf/+K1ex4JqKc5rf/URX3n3p8XdZ6+15uXPaSayC6adWbNxkFskuMCOifDoTT+rkqMtFkDclOy884RuGGtUysq3X7zkAWYTKi8QAfKkajvVbZl2y23UqgVasdQu3OVBQCrH/xY00nNAs/52e958nVjBuzQkSb1T8pKJAyjZsHJ60+FtnfafDZSTAIBJYn7UWBCwQ==",
    56          "subType": "00"
    57        }
    58      },
    59      "creationDate": {
    60        "$date": {
    61          "$numberLong": "1648914851981"
    62        }
    63      },
    64      "updateDate": {
    65        "$date": {
    66          "$numberLong": "1648914851981"
    67        }
    68      },
    69      "status": {
    70        "$numberInt": "0"
    71      },
    72      "masterKey": {
    73        "provider": "local"
    74      }
    75    }
    76  ],
    77  "tests": [
    78    {
    79      "description": "Update can query an FLE2 indexed field",
    80      "clientOptions": {
    81        "autoEncryptOpts": {
    82          "kmsProviders": {
    83            "local": {
    84              "key": {
    85                "$binary": {
    86                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
    87                  "subType": "00"
    88                }
    89              }
    90            }
    91          }
    92        }
    93      },
    94      "operations": [
    95        {
    96          "name": "insertOne",
    97          "arguments": {
    98            "document": {
    99              "_id": 1,
   100              "encryptedIndexed": "value123"
   101            }
   102          }
   103        },
   104        {
   105          "name": "updateOne",
   106          "arguments": {
   107            "filter": {
   108              "encryptedIndexed": "value123"
   109            },
   110            "update": {
   111              "$set": {
   112                "foo": "bar"
   113              }
   114            }
   115          },
   116          "result": {
   117            "matchedCount": 1,
   118            "modifiedCount": 1,
   119            "upsertedCount": 0
   120          }
   121        }
   122      ],
   123      "expectations": [
   124        {
   125          "command_started_event": {
   126            "command": {
   127              "listCollections": 1,
   128              "filter": {
   129                "name": "default"
   130              }
   131            },
   132            "command_name": "listCollections"
   133          }
   134        },
   135        {
   136          "command_started_event": {
   137            "command": {
   138              "find": "datakeys",
   139              "filter": {
   140                "$or": [
   141                  {
   142                    "_id": {
   143                      "$in": [
   144                        {
   145                          "$binary": {
   146                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   147                            "subType": "04"
   148                          }
   149                        }
   150                      ]
   151                    }
   152                  },
   153                  {
   154                    "keyAltNames": {
   155                      "$in": []
   156                    }
   157                  }
   158                ]
   159              },
   160              "$db": "keyvault",
   161              "readConcern": {
   162                "level": "majority"
   163              }
   164            },
   165            "command_name": "find"
   166          }
   167        },
   168        {
   169          "command_started_event": {
   170            "command": {
   171              "insert": "default",
   172              "documents": [
   173                {
   174                  "_id": 1,
   175                  "encryptedIndexed": {
   176                    "$$type": "binData"
   177                  }
   178                }
   179              ],
   180              "ordered": true,
   181              "encryptionInformation": {
   182                "type": 1,
   183                "schema": {
   184                  "default.default": {
   185                    "escCollection": "enxcol_.default.esc",
   186                    "ecocCollection": "enxcol_.default.ecoc",
   187                    "fields": [
   188                      {
   189                        "keyId": {
   190                          "$binary": {
   191                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   192                            "subType": "04"
   193                          }
   194                        },
   195                        "path": "encryptedIndexed",
   196                        "bsonType": "string",
   197                        "queries": {
   198                          "queryType": "equality",
   199                          "contention": {
   200                            "$numberLong": "0"
   201                          }
   202                        }
   203                      },
   204                      {
   205                        "keyId": {
   206                          "$binary": {
   207                            "base64": "q83vqxI0mHYSNBI0VniQEg==",
   208                            "subType": "04"
   209                          }
   210                        },
   211                        "path": "encryptedUnindexed",
   212                        "bsonType": "string"
   213                      }
   214                    ]
   215                  }
   216                }
   217              }
   218            },
   219            "command_name": "insert"
   220          }
   221        },
   222        {
   223          "command_started_event": {
   224            "command": {
   225              "update": "default",
   226              "updates": [
   227                {
   228                  "q": {
   229                    "encryptedIndexed": {
   230                      "$eq": {
   231                        "$binary": {
   232                          "base64": "DIkAAAAFZAAgAAAAAPtVteJQAlgb2YMa/+7YWH00sbQPyt7L6Rb8OwBdMmL2BXMAIAAAAAAd44hgVKnEnTFlwNVC14oyc9OZOTspeymusqkRQj57nAVsACAAAAAAaZ9s3G+4znfxStxeOZwcZy1OhzjMGc5hjmdMN+b/w6kSY20AAAAAAAAAAAAA",
   233                          "subType": "06"
   234                        }
   235                      }
   236                    }
   237                  },
   238                  "u": {
   239                    "$set": {
   240                      "foo": "bar"
   241                    }
   242                  }
   243                }
   244              ],
   245              "ordered": true,
   246              "encryptionInformation": {
   247                "type": 1,
   248                "schema": {
   249                  "default.default": {
   250                    "escCollection": "enxcol_.default.esc",
   251                    "ecocCollection": "enxcol_.default.ecoc",
   252                    "fields": [
   253                      {
   254                        "keyId": {
   255                          "$binary": {
   256                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   257                            "subType": "04"
   258                          }
   259                        },
   260                        "path": "encryptedIndexed",
   261                        "bsonType": "string",
   262                        "queries": {
   263                          "queryType": "equality",
   264                          "contention": {
   265                            "$numberLong": "0"
   266                          }
   267                        }
   268                      },
   269                      {
   270                        "keyId": {
   271                          "$binary": {
   272                            "base64": "q83vqxI0mHYSNBI0VniQEg==",
   273                            "subType": "04"
   274                          }
   275                        },
   276                        "path": "encryptedUnindexed",
   277                        "bsonType": "string"
   278                      }
   279                    ]
   280                  }
   281                }
   282              }
   283            },
   284            "command_name": "update"
   285          }
   286        }
   287      ],
   288      "outcome": {
   289        "collection": {
   290          "data": [
   291            {
   292              "_id": 1,
   293              "encryptedIndexed": {
   294                "$$type": "binData"
   295              },
   296              "foo": "bar",
   297              "__safeContent__": [
   298                {
   299                  "$binary": {
   300                    "base64": "ThpoKfQ8AkOzkFfNC1+9PF0pY2nIzfXvRdxQgjkNbBw=",
   301                    "subType": "00"
   302                  }
   303                }
   304              ]
   305            }
   306          ]
   307        }
   308      }
   309    },
   310    {
   311      "description": "Update can modify an FLE2 indexed field",
   312      "clientOptions": {
   313        "autoEncryptOpts": {
   314          "kmsProviders": {
   315            "local": {
   316              "key": {
   317                "$binary": {
   318                  "base64": "Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk",
   319                  "subType": "00"
   320                }
   321              }
   322            }
   323          }
   324        }
   325      },
   326      "operations": [
   327        {
   328          "name": "insertOne",
   329          "arguments": {
   330            "document": {
   331              "_id": 1,
   332              "encryptedIndexed": "value123"
   333            }
   334          }
   335        },
   336        {
   337          "name": "updateOne",
   338          "arguments": {
   339            "filter": {
   340              "encryptedIndexed": "value123"
   341            },
   342            "update": {
   343              "$set": {
   344                "encryptedIndexed": "value456"
   345              }
   346            }
   347          },
   348          "result": {
   349            "matchedCount": 1,
   350            "modifiedCount": 1,
   351            "upsertedCount": 0
   352          }
   353        },
   354        {
   355          "name": "find",
   356          "arguments": {
   357            "filter": {
   358              "_id": 1
   359            }
   360          },
   361          "result": [
   362            {
   363              "encryptedIndexed": "value456"
   364            }
   365          ]
   366        }
   367      ],
   368      "expectations": [
   369        {
   370          "command_started_event": {
   371            "command": {
   372              "listCollections": 1,
   373              "filter": {
   374                "name": "default"
   375              }
   376            },
   377            "command_name": "listCollections"
   378          }
   379        },
   380        {
   381          "command_started_event": {
   382            "command": {
   383              "find": "datakeys",
   384              "filter": {
   385                "$or": [
   386                  {
   387                    "_id": {
   388                      "$in": [
   389                        {
   390                          "$binary": {
   391                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   392                            "subType": "04"
   393                          }
   394                        }
   395                      ]
   396                    }
   397                  },
   398                  {
   399                    "keyAltNames": {
   400                      "$in": []
   401                    }
   402                  }
   403                ]
   404              },
   405              "$db": "keyvault",
   406              "readConcern": {
   407                "level": "majority"
   408              }
   409            },
   410            "command_name": "find"
   411          }
   412        },
   413        {
   414          "command_started_event": {
   415            "command": {
   416              "insert": "default",
   417              "documents": [
   418                {
   419                  "_id": 1,
   420                  "encryptedIndexed": {
   421                    "$$type": "binData"
   422                  }
   423                }
   424              ],
   425              "ordered": true,
   426              "encryptionInformation": {
   427                "type": 1,
   428                "schema": {
   429                  "default.default": {
   430                    "escCollection": "enxcol_.default.esc",
   431                    "ecocCollection": "enxcol_.default.ecoc",
   432                    "fields": [
   433                      {
   434                        "keyId": {
   435                          "$binary": {
   436                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   437                            "subType": "04"
   438                          }
   439                        },
   440                        "path": "encryptedIndexed",
   441                        "bsonType": "string",
   442                        "queries": {
   443                          "queryType": "equality",
   444                          "contention": {
   445                            "$numberLong": "0"
   446                          }
   447                        }
   448                      },
   449                      {
   450                        "keyId": {
   451                          "$binary": {
   452                            "base64": "q83vqxI0mHYSNBI0VniQEg==",
   453                            "subType": "04"
   454                          }
   455                        },
   456                        "path": "encryptedUnindexed",
   457                        "bsonType": "string"
   458                      }
   459                    ]
   460                  }
   461                }
   462              }
   463            },
   464            "command_name": "insert"
   465          }
   466        },
   467        {
   468          "command_started_event": {
   469            "command": {
   470              "update": "default",
   471              "updates": [
   472                {
   473                  "q": {
   474                    "encryptedIndexed": {
   475                      "$eq": {
   476                        "$binary": {
   477                          "base64": "DIkAAAAFZAAgAAAAAPtVteJQAlgb2YMa/+7YWH00sbQPyt7L6Rb8OwBdMmL2BXMAIAAAAAAd44hgVKnEnTFlwNVC14oyc9OZOTspeymusqkRQj57nAVsACAAAAAAaZ9s3G+4znfxStxeOZwcZy1OhzjMGc5hjmdMN+b/w6kSY20AAAAAAAAAAAAA",
   478                          "subType": "06"
   479                        }
   480                      }
   481                    }
   482                  },
   483                  "u": {
   484                    "$set": {
   485                      "encryptedIndexed": {
   486                        "$$type": "binData"
   487                      }
   488                    }
   489                  }
   490                }
   491              ],
   492              "ordered": true,
   493              "encryptionInformation": {
   494                "type": 1,
   495                "schema": {
   496                  "default.default": {
   497                    "escCollection": "enxcol_.default.esc",
   498                    "ecocCollection": "enxcol_.default.ecoc",
   499                    "fields": [
   500                      {
   501                        "keyId": {
   502                          "$binary": {
   503                            "base64": "EjRWeBI0mHYSNBI0VniQEg==",
   504                            "subType": "04"
   505                          }
   506                        },
   507                        "path": "encryptedIndexed",
   508                        "bsonType": "string",
   509                        "queries": {
   510                          "queryType": "equality",
   511                          "contention": {
   512                            "$numberLong": "0"
   513                          }
   514                        }
   515                      },
   516                      {
   517                        "keyId": {
   518                          "$binary": {
   519                            "base64": "q83vqxI0mHYSNBI0VniQEg==",
   520                            "subType": "04"
   521                          }
   522                        },
   523                        "path": "encryptedUnindexed",
   524                        "bsonType": "string"
   525                      }
   526                    ]
   527                  }
   528                }
   529              }
   530            },
   531            "command_name": "update"
   532          }
   533        },
   534        {
   535          "command_started_event": {
   536            "command": {
   537              "find": "default",
   538              "filter": {
   539                "_id": {
   540                  "$eq": 1
   541                }
   542              }
   543            },
   544            "command_name": "find"
   545          }
   546        }
   547      ],
   548      "outcome": {
   549        "collection": {
   550          "data": [
   551            {
   552              "_id": 1,
   553              "encryptedIndexed": {
   554                "$$type": "binData"
   555              },
   556              "__safeContent__": [
   557                {
   558                  "$binary": {
   559                    "base64": "rhe7/w8Ob8Unl44rGr/moScx6m5VODQnscDhF4Nkn6g=",
   560                    "subType": "00"
   561                  }
   562                }
   563              ]
   564            }
   565          ]
   566        }
   567      }
   568    }
   569  ]
   570}

View as plain text