[{"data":1,"prerenderedAt":3727},["ShallowReactive",2],{"blog:2025:mongodb-queryable-encryption":3,"blogMore-Development":3713,"comments-mongodb-queryable-encryption":3726},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"category":11,"tags":12,"excerpt":15,"body":50,"_type":3704,"_id":3705,"_source":3706,"_file":3707,"_stem":3708,"_extension":3709,"url":3710,"wordCount":3711,"minutes":1147,"commentCount":3712},"/blog/2025/mongodb-queryable-encryption","2025",false,"en","Queryable Encryption with the MongoDB EF Core Provider","MongoDB's Queryable Encryption lets you encrypt sensitive database fields while keeping them searchable. Unlike traditional encryption-at-rest that renders data unreadable to the database, queryable encryption supports equality and range queries on encrypted fields without requiring decryption first.","2025-09-22","Development",[13,14],"Entity Framework","MongoDB",{"type":16,"children":17},"root",[18,28],{"type":19,"tag":20,"props":21,"children":22},"element","p",{},[23,26],{"type":24,"value":25},"text","MongoDB's Queryable Encryption",{"type":24,"value":27}," lets you encrypt sensitive database fields while keeping them searchable. Unlike traditional encryption-at-rest that renders data unreadable to the database, queryable encryption supports equality and range queries on encrypted fields without requiring decryption first.",{"type":19,"tag":20,"props":29,"children":30},{},[31,33,40,42,48],{"type":24,"value":32},"For example, you can encrypt an employees email address and still query ",{"type":19,"tag":34,"props":35,"children":37},"code",{"className":36},[],[38],{"type":24,"value":39},"users.Where(u => u.Email == \"john@example.com\")",{"type":24,"value":41}," or encrypt salaries and query ",{"type":19,"tag":34,"props":43,"children":45},{"className":44},[],[46],{"type":24,"value":47},"employees.Where(e => e.Salary > 50000m)",{"type":24,"value":49}," without any changes to your application code.",{"type":16,"children":51,"toc":3678},[52,64,80,102,109,114,127,134,156,215,221,235,241,246,252,270,275,281,286,299,358,364,378,391,625,631,644,649,743,749,754,761,782,787,800,868,874,879,914,928,934,939,1228,1256,1262,1275,1483,1488,1745,1750,1787,1792,2370,2376,2396,2882,2888,2893,3152,3157,3163,3176,3181,3189,3202,3208,3213,3219,3541,3547,3552,3583,3589,3594,3599,3637,3643,3648,3662,3667,3672],{"type":19,"tag":20,"props":53,"children":54},{},[55,63],{"type":19,"tag":56,"props":57,"children":61},"a",{"href":58,"rel":59},"https://www.mongodb.com/docs/manual/core/queryable-encryption/",[60],"nofollow",[62],{"type":24,"value":25},{"type":24,"value":27},{"type":19,"tag":20,"props":65,"children":66},{},[67,68,73,74,79],{"type":24,"value":32},{"type":19,"tag":34,"props":69,"children":71},{"className":70},[],[72],{"type":24,"value":39},{"type":24,"value":41},{"type":19,"tag":34,"props":75,"children":77},{"className":76},[],[78],{"type":24,"value":47},{"type":24,"value":49},{"type":19,"tag":20,"props":81,"children":82},{},[83,85,92,94,100],{"type":24,"value":84},"This tutorial assumes basic familiarity with ",{"type":19,"tag":56,"props":86,"children":89},{"href":87,"rel":88},"https://docs.microsoft.com/en-us/ef/core/",[60],[90],{"type":24,"value":91},"Entity Framework Core",{"type":24,"value":93}," and ",{"type":19,"tag":56,"props":95,"children":98},{"href":96,"rel":97},"https://docs.mongodb.com/manual/tutorial/getting-started/",[60],[99],{"type":24,"value":14},{"type":24,"value":101},".",{"type":19,"tag":103,"props":104,"children":106},"h2",{"id":105},"prerequisites",[107],{"type":24,"value":108},"Prerequisites",{"type":19,"tag":20,"props":110,"children":111},{},[112],{"type":24,"value":113},"Before we dive into queryable encryption, let's make sure you have everything you need to follow along with this tutorial.",{"type":19,"tag":20,"props":115,"children":116},{},[117,119,125],{"type":24,"value":118},"You'll need ",{"type":19,"tag":120,"props":121,"children":122},"strong",{},[123],{"type":24,"value":124},"MongoDB Enterprise 8.0 or Atlas",{"type":24,"value":126}," (Community Edition does not support automatic encryption). You can either use:",{"type":19,"tag":128,"props":129,"children":131},"h3",{"id":130},"docker",[132],{"type":24,"value":133},"Docker",{"type":19,"tag":20,"props":135,"children":136},{},[137,139,145,147,154],{"type":24,"value":138},"Install ",{"type":19,"tag":56,"props":140,"children":143},{"href":141,"rel":142},"https://www.docker.com/",[60],[144],{"type":24,"value":133},{"type":24,"value":146}," if you don't already have it and then fire up the ",{"type":19,"tag":56,"props":148,"children":151},{"href":149,"rel":150},"https://hub.docker.com/r/mongodb/mongodb-atlas-local",[60],[152],{"type":24,"value":153},"MongoDB Atlas Local Docker image",{"type":24,"value":155}," by simply running:",{"type":19,"tag":157,"props":158,"children":163},"pre",{"className":159,"code":160,"language":161,"meta":162,"style":162},"language-bash shiki shiki-themes everforest-light dracula","docker run --name mongodb-atlas-local -p 27017:27017 -d mongodb/mongodb-atlas-local:latest\n","bash","",[164],{"type":19,"tag":34,"props":165,"children":166},{"__ignoreMap":162},[167],{"type":19,"tag":168,"props":169,"children":172},"span",{"class":170,"line":171},"line",1,[173,178,184,190,195,200,205,210],{"type":19,"tag":168,"props":174,"children":176},{"style":175},"--shiki-default:#8DA101;--shiki-dark:#50FA7B",[177],{"type":24,"value":130},{"type":19,"tag":168,"props":179,"children":181},{"style":180},"--shiki-default:#DFA000;--shiki-dark:#F1FA8C",[182],{"type":24,"value":183}," run",{"type":19,"tag":168,"props":185,"children":187},{"style":186},"--shiki-default:#DFA000;--shiki-dark:#BD93F9",[188],{"type":24,"value":189}," --name",{"type":19,"tag":168,"props":191,"children":192},{"style":180},[193],{"type":24,"value":194}," mongodb-atlas-local",{"type":19,"tag":168,"props":196,"children":197},{"style":186},[198],{"type":24,"value":199}," -p",{"type":19,"tag":168,"props":201,"children":202},{"style":180},[203],{"type":24,"value":204}," 27017:27017",{"type":19,"tag":168,"props":206,"children":207},{"style":186},[208],{"type":24,"value":209}," -d",{"type":19,"tag":168,"props":211,"children":212},{"style":180},[213],{"type":24,"value":214}," mongodb/mongodb-atlas-local:latest\n",{"type":19,"tag":128,"props":216,"children":218},{"id":217},"atlas-cloud",[219],{"type":24,"value":220},"Atlas Cloud",{"type":19,"tag":20,"props":222,"children":223},{},[224,226,233],{"type":24,"value":225},"Alternatively you can create a MongoDB Atlas instance directly on ",{"type":19,"tag":56,"props":227,"children":230},{"href":228,"rel":229},"https://www.mongodb.com/products/platform/cloud",[60],[231],{"type":24,"value":232},"MongoDB Cloud",{"type":24,"value":234}," or on your favorite cloud provider and ensure you can remotely access it.",{"type":19,"tag":128,"props":236,"children":238},{"id":237},"enterprise-self-hosted",[239],{"type":24,"value":240},"Enterprise Self-Hosted",{"type":19,"tag":20,"props":242,"children":243},{},[244],{"type":24,"value":245},"If you already have access to a MongoDB Enterprise 8.0 or later installation you are good-to-go and just need a connection string and necessary access.",{"type":19,"tag":103,"props":247,"children":249},{"id":248},"keys",[250],{"type":24,"value":251},"Keys",{"type":19,"tag":253,"props":254,"children":255},"blockquote",{},[256],{"type":19,"tag":20,"props":257,"children":258},{},[259,261,268],{"type":24,"value":260},"Encryption key management is a complex topic that involves serious consideration of secure storage of your Customer Master Key in a secure management service as well as considerations for your key rotation process. These are beyond the scope of this tutorial but touched on in ",{"type":19,"tag":56,"props":262,"children":265},{"href":263,"rel":264},"https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/keys-key-vaults/",[60],[266],{"type":24,"value":267},"Encryption Keys and Key Vaults",{"type":24,"value":269}," which should be followed for production scenarios.",{"type":19,"tag":20,"props":271,"children":272},{},[273],{"type":24,"value":274},"Let's look at the components needed to get encryption running specifically from the local development angle.",{"type":19,"tag":128,"props":276,"children":278},{"id":277},"customer-master-key-cmk",[279],{"type":24,"value":280},"Customer Master Key (CMK)",{"type":19,"tag":20,"props":282,"children":283},{},[284],{"type":24,"value":285},"The Customer Master Key is the sensitive secret used to encrypt and decrypt all the individual field-level Data Encryption Keys.",{"type":19,"tag":20,"props":287,"children":288},{},[289,291,297],{"type":24,"value":290},"For our local testing we'll generate a ",{"type":19,"tag":56,"props":292,"children":295},{"href":293,"rel":294},"https://www.mongodb.com/docs/manual/core/queryable-encryption/qe-create-cmk/",[60],[296],{"type":24,"value":280},{"type":24,"value":298}," with the following code. This will output a 768-bit key as a base-64 encoded string which we will - for testing purposes - embed in our application. In production this key would have been externally generated and stored in a remote Key Management System.",{"type":19,"tag":157,"props":300,"children":304},{"className":301,"code":302,"language":303,"meta":162,"style":162},"language-csharp shiki shiki-themes everforest-light dracula","Console.WriteLine(Convert.ToBase64String(RandomNumberGenerator.GetBytes(96)));\n","csharp",[305],{"type":19,"tag":34,"props":306,"children":307},{"__ignoreMap":162},[308],{"type":19,"tag":168,"props":309,"children":310},{"class":170,"line":171},[311,317,322,327,332,337,342,347,353],{"type":19,"tag":168,"props":312,"children":314},{"style":313},"--shiki-default:#5C6A72;--shiki-dark:#F8F8F2",[315],{"type":24,"value":316},"Console.",{"type":19,"tag":168,"props":318,"children":319},{"style":175},[320],{"type":24,"value":321},"WriteLine",{"type":19,"tag":168,"props":323,"children":324},{"style":313},[325],{"type":24,"value":326},"(Convert.",{"type":19,"tag":168,"props":328,"children":329},{"style":175},[330],{"type":24,"value":331},"ToBase64String",{"type":19,"tag":168,"props":333,"children":334},{"style":313},[335],{"type":24,"value":336},"(RandomNumberGenerator.",{"type":19,"tag":168,"props":338,"children":339},{"style":175},[340],{"type":24,"value":341},"GetBytes",{"type":19,"tag":168,"props":343,"children":344},{"style":313},[345],{"type":24,"value":346},"(",{"type":19,"tag":168,"props":348,"children":350},{"style":349},"--shiki-default:#DF69BA;--shiki-dark:#BD93F9",[351],{"type":24,"value":352},"96",{"type":19,"tag":168,"props":354,"children":355},{"style":313},[356],{"type":24,"value":357},")));\n",{"type":19,"tag":128,"props":359,"children":361},{"id":360},"key-management-systems-kms",[362],{"type":24,"value":363},"Key Management Systems (KMS)",{"type":19,"tag":20,"props":365,"children":366},{},[367,369,376],{"type":24,"value":368},"MongoDB drivers support a number of ",{"type":19,"tag":56,"props":370,"children":373},{"href":371,"rel":372},"https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/kms-providers/",[60],[374],{"type":24,"value":375},"secure key management systems",{"type":24,"value":377}," including Amazon AWS KMS, Azure Key Vault and Google Cloud KMS.",{"type":19,"tag":20,"props":379,"children":380},{},[381,383,389],{"type":24,"value":382},"For our local testing we'll create the required dictionary of KMS providers with just one provider called ",{"type":19,"tag":34,"props":384,"children":386},{"className":385},[],[387],{"type":24,"value":388},"local",{"type":24,"value":390}," that will contain our Customer Master Key.",{"type":19,"tag":157,"props":392,"children":394},{"className":301,"code":393,"language":303,"meta":162,"style":162},"var customerMasterKey = Convert.FromBase64String(\"gT6tpjPkeEmKYra2...b0Vfga\");\n\nvar kmsProviders = new Dictionary\u003Cstring, IReadOnlyDictionary\u003Cstring, object>>\n{\n    { \"local\", new Dictionary\u003Cstring, object> { { \"key\", customerMasterKey } } }\n};\n",[395],{"type":19,"tag":34,"props":396,"children":397},{"__ignoreMap":162},[398,453,463,534,543,616],{"type":19,"tag":168,"props":399,"children":400},{"class":170,"line":171},[401,407,412,418,423,428,432,438,444,448],{"type":19,"tag":168,"props":402,"children":404},{"style":403},"--shiki-default:#3A94C5;--shiki-dark:#FF79C6",[405],{"type":24,"value":406},"var",{"type":19,"tag":168,"props":408,"children":409},{"style":313},[410],{"type":24,"value":411}," customerMasterKey ",{"type":19,"tag":168,"props":413,"children":415},{"style":414},"--shiki-default:#F57D26;--shiki-dark:#FF79C6",[416],{"type":24,"value":417},"=",{"type":19,"tag":168,"props":419,"children":420},{"style":313},[421],{"type":24,"value":422}," Convert.",{"type":19,"tag":168,"props":424,"children":425},{"style":175},[426],{"type":24,"value":427},"FromBase64String",{"type":19,"tag":168,"props":429,"children":430},{"style":313},[431],{"type":24,"value":346},{"type":19,"tag":168,"props":433,"children":435},{"style":434},"--shiki-default:#8DA101;--shiki-dark:#E9F284",[436],{"type":24,"value":437},"\"",{"type":19,"tag":168,"props":439,"children":441},{"style":440},"--shiki-default:#8DA101;--shiki-dark:#F1FA8C",[442],{"type":24,"value":443},"gT6tpjPkeEmKYra2...b0Vfga",{"type":19,"tag":168,"props":445,"children":446},{"style":434},[447],{"type":24,"value":437},{"type":19,"tag":168,"props":449,"children":450},{"style":313},[451],{"type":24,"value":452},");\n",{"type":19,"tag":168,"props":454,"children":456},{"class":170,"line":455},2,[457],{"type":19,"tag":168,"props":458,"children":460},{"emptyLinePlaceholder":459},true,[461],{"type":24,"value":462},"\n",{"type":19,"tag":168,"props":464,"children":466},{"class":170,"line":465},3,[467,471,476,480,486,492,497,502,507,512,516,520,524,529],{"type":19,"tag":168,"props":468,"children":469},{"style":403},[470],{"type":24,"value":406},{"type":19,"tag":168,"props":472,"children":473},{"style":313},[474],{"type":24,"value":475}," kmsProviders ",{"type":19,"tag":168,"props":477,"children":478},{"style":414},[479],{"type":24,"value":417},{"type":19,"tag":168,"props":481,"children":483},{"style":482},"--shiki-default:#F85552;--shiki-dark:#FF79C6",[484],{"type":24,"value":485}," new",{"type":19,"tag":168,"props":487,"children":489},{"style":488},"--shiki-default:#3A94C5;--shiki-default-font-style:inherit;--shiki-dark:#8BE9FD;--shiki-dark-font-style:italic",[490],{"type":24,"value":491}," Dictionary",{"type":19,"tag":168,"props":493,"children":494},{"style":313},[495],{"type":24,"value":496},"\u003C",{"type":19,"tag":168,"props":498,"children":499},{"style":403},[500],{"type":24,"value":501},"string",{"type":19,"tag":168,"props":503,"children":504},{"style":313},[505],{"type":24,"value":506},", ",{"type":19,"tag":168,"props":508,"children":509},{"style":488},[510],{"type":24,"value":511},"IReadOnlyDictionary",{"type":19,"tag":168,"props":513,"children":514},{"style":313},[515],{"type":24,"value":496},{"type":19,"tag":168,"props":517,"children":518},{"style":403},[519],{"type":24,"value":501},{"type":19,"tag":168,"props":521,"children":522},{"style":313},[523],{"type":24,"value":506},{"type":19,"tag":168,"props":525,"children":526},{"style":403},[527],{"type":24,"value":528},"object",{"type":19,"tag":168,"props":530,"children":531},{"style":313},[532],{"type":24,"value":533},">>\n",{"type":19,"tag":168,"props":535,"children":537},{"class":170,"line":536},4,[538],{"type":19,"tag":168,"props":539,"children":540},{"style":313},[541],{"type":24,"value":542},"{\n",{"type":19,"tag":168,"props":544,"children":546},{"class":170,"line":545},5,[547,552,556,560,564,568,573,577,581,585,589,593,598,602,607,611],{"type":19,"tag":168,"props":548,"children":549},{"style":313},[550],{"type":24,"value":551},"    { ",{"type":19,"tag":168,"props":553,"children":554},{"style":434},[555],{"type":24,"value":437},{"type":19,"tag":168,"props":557,"children":558},{"style":440},[559],{"type":24,"value":388},{"type":19,"tag":168,"props":561,"children":562},{"style":434},[563],{"type":24,"value":437},{"type":19,"tag":168,"props":565,"children":566},{"style":313},[567],{"type":24,"value":506},{"type":19,"tag":168,"props":569,"children":570},{"style":482},[571],{"type":24,"value":572},"new",{"type":19,"tag":168,"props":574,"children":575},{"style":488},[576],{"type":24,"value":491},{"type":19,"tag":168,"props":578,"children":579},{"style":313},[580],{"type":24,"value":496},{"type":19,"tag":168,"props":582,"children":583},{"style":403},[584],{"type":24,"value":501},{"type":19,"tag":168,"props":586,"children":587},{"style":313},[588],{"type":24,"value":506},{"type":19,"tag":168,"props":590,"children":591},{"style":403},[592],{"type":24,"value":528},{"type":19,"tag":168,"props":594,"children":595},{"style":313},[596],{"type":24,"value":597},"> { { ",{"type":19,"tag":168,"props":599,"children":600},{"style":434},[601],{"type":24,"value":437},{"type":19,"tag":168,"props":603,"children":604},{"style":440},[605],{"type":24,"value":606},"key",{"type":19,"tag":168,"props":608,"children":609},{"style":434},[610],{"type":24,"value":437},{"type":19,"tag":168,"props":612,"children":613},{"style":313},[614],{"type":24,"value":615},", customerMasterKey } } }\n",{"type":19,"tag":168,"props":617,"children":619},{"class":170,"line":618},6,[620],{"type":19,"tag":168,"props":621,"children":622},{"style":313},[623],{"type":24,"value":624},"};\n",{"type":19,"tag":128,"props":626,"children":628},{"id":627},"data-encryption-keys-dek",[629],{"type":24,"value":630},"Data Encryption Keys (DEK)",{"type":19,"tag":20,"props":632,"children":633},{},[634,636,642],{"type":24,"value":635},"Data Encryption Keys are encryption keys used to encrypt individual fields. They are stored in a MongoDB collection known as the Key Vault (typically named ",{"type":19,"tag":34,"props":637,"children":639},{"className":638},[],[640],{"type":24,"value":641},"__keyVault",{"type":24,"value":643}," within your database) and are themselves encrypted with the Customer Master Key.",{"type":19,"tag":20,"props":645,"children":646},{},[647],{"type":24,"value":648},"We'll generate the Data Encryption Keys in a moment but let's specify the database and key vault now in our code:",{"type":19,"tag":157,"props":650,"children":652},{"className":301,"code":651,"language":303,"meta":162,"style":162},"const string databaseName = \"queryable-encryption-fun\";\nvar keyVaultNamespace = new CollectionNamespace(databaseName, \"__keyVault\");\n",[653],{"type":19,"tag":34,"props":654,"children":655},{"__ignoreMap":162},[656,697],{"type":19,"tag":168,"props":657,"children":658},{"class":170,"line":171},[659,664,669,674,678,683,688,692],{"type":19,"tag":168,"props":660,"children":661},{"style":414},[662],{"type":24,"value":663},"const",{"type":19,"tag":168,"props":665,"children":666},{"style":403},[667],{"type":24,"value":668}," string",{"type":19,"tag":168,"props":670,"children":671},{"style":313},[672],{"type":24,"value":673}," databaseName ",{"type":19,"tag":168,"props":675,"children":676},{"style":414},[677],{"type":24,"value":417},{"type":19,"tag":168,"props":679,"children":680},{"style":434},[681],{"type":24,"value":682}," \"",{"type":19,"tag":168,"props":684,"children":685},{"style":440},[686],{"type":24,"value":687},"queryable-encryption-fun",{"type":19,"tag":168,"props":689,"children":690},{"style":434},[691],{"type":24,"value":437},{"type":19,"tag":168,"props":693,"children":694},{"style":313},[695],{"type":24,"value":696},";\n",{"type":19,"tag":168,"props":698,"children":699},{"class":170,"line":455},[700,704,709,713,717,722,727,731,735,739],{"type":19,"tag":168,"props":701,"children":702},{"style":403},[703],{"type":24,"value":406},{"type":19,"tag":168,"props":705,"children":706},{"style":313},[707],{"type":24,"value":708}," keyVaultNamespace ",{"type":19,"tag":168,"props":710,"children":711},{"style":414},[712],{"type":24,"value":417},{"type":19,"tag":168,"props":714,"children":715},{"style":482},[716],{"type":24,"value":485},{"type":19,"tag":168,"props":718,"children":719},{"style":488},[720],{"type":24,"value":721}," CollectionNamespace",{"type":19,"tag":168,"props":723,"children":724},{"style":313},[725],{"type":24,"value":726},"(databaseName, ",{"type":19,"tag":168,"props":728,"children":729},{"style":434},[730],{"type":24,"value":437},{"type":19,"tag":168,"props":732,"children":733},{"style":440},[734],{"type":24,"value":641},{"type":19,"tag":168,"props":736,"children":737},{"style":434},[738],{"type":24,"value":437},{"type":19,"tag":168,"props":740,"children":741},{"style":313},[742],{"type":24,"value":452},{"type":19,"tag":128,"props":744,"children":746},{"id":745},"automatic-encryption",[747],{"type":24,"value":748},"Automatic Encryption",{"type":19,"tag":20,"props":750,"children":751},{},[752],{"type":24,"value":753},"In order to make encryption transparent to the application a component is required to automatically encrypt and decrypt the fields. There are two options available as part of either a MongoDB Enterprise or Atlas subscription (Community Edition is not supported).",{"type":19,"tag":755,"props":756,"children":758},"h4",{"id":757},"automatic-encryption-shared-library-crypt_shared",[759],{"type":24,"value":760},"Automatic Encryption Shared Library (crypt_shared)",{"type":19,"tag":20,"props":762,"children":763},{},[764,766,773,775,780],{"type":24,"value":765},"The Automatic Encryption Shared Library is a dynamic library that performs the automatic encryption for you in-process as part of your application. It is the recommended approach for new applications and can be downloaded from the ",{"type":19,"tag":56,"props":767,"children":770},{"href":768,"rel":769},"https://www.mongodb.com/try/download/enterprise",[60],[771],{"type":24,"value":772},"MongoDB Enterprise Server Page",{"type":24,"value":774}," - just switch the package to ",{"type":19,"tag":120,"props":776,"children":777},{},[778],{"type":24,"value":779},"crypt_shared",{"type":24,"value":781}," once you have selected your version and platform and the place the extracted library somewhere your application can reference it.",{"type":19,"tag":755,"props":783,"children":785},{"id":784},"mongocryptd",[786],{"type":24,"value":784},{"type":19,"tag":20,"props":788,"children":789},{},[790,792,798],{"type":24,"value":791},"You can also use the ",{"type":19,"tag":56,"props":793,"children":796},{"href":794,"rel":795},"https://www.mongodb.com/docs/manual/core/csfle/reference/install-library/",[60],[797],{"type":24,"value":784},{"type":24,"value":799}," local background process that is supplied as part of MongoDB Enterprise Server which uses a different port number to connect. You'll also need to tell our EF Core Provider you want to use it and where the binary is so it can auto-start it if required.",{"type":19,"tag":157,"props":801,"children":803},{"className":301,"code":802,"language":303,"meta":162,"style":162},".WithCryptProvider(CryptProvider.Mongocryptd, \"C:\\\\MongoDB\"); // Adjust for your path\n",[804],{"type":19,"tag":34,"props":805,"children":806},{"__ignoreMap":162},[807],{"type":19,"tag":168,"props":808,"children":809},{"class":170,"line":171},[810,814,819,824,830,834,838,843,849,853,857,862],{"type":19,"tag":168,"props":811,"children":812},{"style":313},[813],{"type":24,"value":101},{"type":19,"tag":168,"props":815,"children":816},{"style":175},[817],{"type":24,"value":818},"WithCryptProvider",{"type":19,"tag":168,"props":820,"children":821},{"style":313},[822],{"type":24,"value":823},"(CryptProvider.",{"type":19,"tag":168,"props":825,"children":827},{"style":826},"--shiki-default:#35A77C;--shiki-dark:#F8F8F2",[828],{"type":24,"value":829},"Mongocryptd",{"type":19,"tag":168,"props":831,"children":832},{"style":313},[833],{"type":24,"value":506},{"type":19,"tag":168,"props":835,"children":836},{"style":434},[837],{"type":24,"value":437},{"type":19,"tag":168,"props":839,"children":840},{"style":440},[841],{"type":24,"value":842},"C:",{"type":19,"tag":168,"props":844,"children":846},{"style":845},"--shiki-default:#DFA000;--shiki-dark:#FF79C6",[847],{"type":24,"value":848},"\\\\",{"type":19,"tag":168,"props":850,"children":851},{"style":440},[852],{"type":24,"value":14},{"type":19,"tag":168,"props":854,"children":855},{"style":434},[856],{"type":24,"value":437},{"type":19,"tag":168,"props":858,"children":859},{"style":313},[860],{"type":24,"value":861},"); ",{"type":19,"tag":168,"props":863,"children":865},{"style":864},"--shiki-default:#939F91;--shiki-default-font-style:italic;--shiki-dark:#6272A4;--shiki-dark-font-style:inherit",[866],{"type":24,"value":867},"// Adjust for your path\n",{"type":19,"tag":103,"props":869,"children":871},{"id":870},"creating-your-project",[872],{"type":24,"value":873},"Creating your project",{"type":19,"tag":20,"props":875,"children":876},{},[877],{"type":24,"value":878},"Create a .NET Core Console project and add two NuGet packages to your project:",{"type":19,"tag":880,"props":881,"children":882},"ul",{},[883,899],{"type":19,"tag":884,"props":885,"children":886},"li",{},[887,897],{"type":19,"tag":120,"props":888,"children":889},{},[890],{"type":19,"tag":56,"props":891,"children":894},{"href":892,"rel":893},"https://www.nuget.org/packages/MongoDB.EntityFrameworkCore",[60],[895],{"type":24,"value":896},"MongoDB.EntityFrameworkCore",{"type":24,"value":898}," (version 9.0.1 or above)",{"type":19,"tag":884,"props":900,"children":901},{},[902,912],{"type":19,"tag":120,"props":903,"children":904},{},[905],{"type":19,"tag":56,"props":906,"children":909},{"href":907,"rel":908},"https://www.nuget.org/packages/MongoDB.Driver.Encryption",[60],[910],{"type":24,"value":911},"MongoDB.Driver.Encryption",{"type":24,"value":913}," (latest version)",{"type":19,"tag":20,"props":915,"children":916},{},[917,919,926],{"type":24,"value":918},"As well as directly bringing in our EF Provider and encryption support this indirectly brings the necessary encryption algorithm library ",{"type":19,"tag":56,"props":920,"children":923},{"href":921,"rel":922},"https://github.com/mongodb/libmongocrypt",[60],[924],{"type":24,"value":925},"libmongocrypt",{"type":24,"value":927}," and our C# Driver to handle the lower-level support for Queryable Encryption.",{"type":19,"tag":128,"props":929,"children":931},{"id":930},"setting-up-your-application",[932],{"type":24,"value":933},"Setting up your application",{"type":19,"tag":20,"props":935,"children":936},{},[937],{"type":24,"value":938},"Now we're ready to configure our EF Core DbContext with the decisions we've made about our connection, keys and auto encryption provider!",{"type":19,"tag":157,"props":940,"children":942},{"className":301,"code":941,"language":303,"meta":162,"style":162},"MongoClientSettings.Extensions.AddAutoEncryption();\nvar clientSettings = MongoClientSettings.\n    FromConnectionString(\"mongodb://localhost:27017?directConnection=true\");\n\nvar options = new DbContextOptionsBuilder()\n    .UseMongoDB(new MongoOptionsExtension()\n        .WithClientSettings(clientSettings)\n        .WithDatabaseName(databaseName)\n        .WithKeyVaultNamespace(keyVaultNamespace)\n        .WithCryptProvider(CryptProvider.AutoEncryptSharedLibrary,\n                           \"C:\\\\MongoDB\\\\mongo_crypt_v1.dll\")\n        .WithKmsProviders(kmsProviders));\n",[943],{"type":19,"tag":34,"props":944,"children":945},{"__ignoreMap":162},[946,973,994,1023,1030,1060,1090,1109,1127,1145,1171,1210],{"type":19,"tag":168,"props":947,"children":948},{"class":170,"line":171},[949,954,959,963,968],{"type":19,"tag":168,"props":950,"children":951},{"style":313},[952],{"type":24,"value":953},"MongoClientSettings.",{"type":19,"tag":168,"props":955,"children":956},{"style":826},[957],{"type":24,"value":958},"Extensions",{"type":19,"tag":168,"props":960,"children":961},{"style":313},[962],{"type":24,"value":101},{"type":19,"tag":168,"props":964,"children":965},{"style":175},[966],{"type":24,"value":967},"AddAutoEncryption",{"type":19,"tag":168,"props":969,"children":970},{"style":313},[971],{"type":24,"value":972},"();\n",{"type":19,"tag":168,"props":974,"children":975},{"class":170,"line":455},[976,980,985,989],{"type":19,"tag":168,"props":977,"children":978},{"style":403},[979],{"type":24,"value":406},{"type":19,"tag":168,"props":981,"children":982},{"style":313},[983],{"type":24,"value":984}," clientSettings ",{"type":19,"tag":168,"props":986,"children":987},{"style":414},[988],{"type":24,"value":417},{"type":19,"tag":168,"props":990,"children":991},{"style":313},[992],{"type":24,"value":993}," MongoClientSettings.\n",{"type":19,"tag":168,"props":995,"children":996},{"class":170,"line":465},[997,1002,1006,1010,1015,1019],{"type":19,"tag":168,"props":998,"children":999},{"style":175},[1000],{"type":24,"value":1001},"    FromConnectionString",{"type":19,"tag":168,"props":1003,"children":1004},{"style":313},[1005],{"type":24,"value":346},{"type":19,"tag":168,"props":1007,"children":1008},{"style":434},[1009],{"type":24,"value":437},{"type":19,"tag":168,"props":1011,"children":1012},{"style":440},[1013],{"type":24,"value":1014},"mongodb://localhost:27017?directConnection=true",{"type":19,"tag":168,"props":1016,"children":1017},{"style":434},[1018],{"type":24,"value":437},{"type":19,"tag":168,"props":1020,"children":1021},{"style":313},[1022],{"type":24,"value":452},{"type":19,"tag":168,"props":1024,"children":1025},{"class":170,"line":536},[1026],{"type":19,"tag":168,"props":1027,"children":1028},{"emptyLinePlaceholder":459},[1029],{"type":24,"value":462},{"type":19,"tag":168,"props":1031,"children":1032},{"class":170,"line":545},[1033,1037,1042,1046,1050,1055],{"type":19,"tag":168,"props":1034,"children":1035},{"style":403},[1036],{"type":24,"value":406},{"type":19,"tag":168,"props":1038,"children":1039},{"style":313},[1040],{"type":24,"value":1041}," options ",{"type":19,"tag":168,"props":1043,"children":1044},{"style":414},[1045],{"type":24,"value":417},{"type":19,"tag":168,"props":1047,"children":1048},{"style":482},[1049],{"type":24,"value":485},{"type":19,"tag":168,"props":1051,"children":1052},{"style":488},[1053],{"type":24,"value":1054}," DbContextOptionsBuilder",{"type":19,"tag":168,"props":1056,"children":1057},{"style":313},[1058],{"type":24,"value":1059},"()\n",{"type":19,"tag":168,"props":1061,"children":1062},{"class":170,"line":618},[1063,1068,1073,1077,1081,1086],{"type":19,"tag":168,"props":1064,"children":1065},{"style":313},[1066],{"type":24,"value":1067},"    .",{"type":19,"tag":168,"props":1069,"children":1070},{"style":175},[1071],{"type":24,"value":1072},"UseMongoDB",{"type":19,"tag":168,"props":1074,"children":1075},{"style":313},[1076],{"type":24,"value":346},{"type":19,"tag":168,"props":1078,"children":1079},{"style":482},[1080],{"type":24,"value":572},{"type":19,"tag":168,"props":1082,"children":1083},{"style":488},[1084],{"type":24,"value":1085}," MongoOptionsExtension",{"type":19,"tag":168,"props":1087,"children":1088},{"style":313},[1089],{"type":24,"value":1059},{"type":19,"tag":168,"props":1091,"children":1093},{"class":170,"line":1092},7,[1094,1099,1104],{"type":19,"tag":168,"props":1095,"children":1096},{"style":313},[1097],{"type":24,"value":1098},"        .",{"type":19,"tag":168,"props":1100,"children":1101},{"style":175},[1102],{"type":24,"value":1103},"WithClientSettings",{"type":19,"tag":168,"props":1105,"children":1106},{"style":313},[1107],{"type":24,"value":1108},"(clientSettings)\n",{"type":19,"tag":168,"props":1110,"children":1112},{"class":170,"line":1111},8,[1113,1117,1122],{"type":19,"tag":168,"props":1114,"children":1115},{"style":313},[1116],{"type":24,"value":1098},{"type":19,"tag":168,"props":1118,"children":1119},{"style":175},[1120],{"type":24,"value":1121},"WithDatabaseName",{"type":19,"tag":168,"props":1123,"children":1124},{"style":313},[1125],{"type":24,"value":1126},"(databaseName)\n",{"type":19,"tag":168,"props":1128,"children":1130},{"class":170,"line":1129},9,[1131,1135,1140],{"type":19,"tag":168,"props":1132,"children":1133},{"style":313},[1134],{"type":24,"value":1098},{"type":19,"tag":168,"props":1136,"children":1137},{"style":175},[1138],{"type":24,"value":1139},"WithKeyVaultNamespace",{"type":19,"tag":168,"props":1141,"children":1142},{"style":313},[1143],{"type":24,"value":1144},"(keyVaultNamespace)\n",{"type":19,"tag":168,"props":1146,"children":1148},{"class":170,"line":1147},10,[1149,1153,1157,1161,1166],{"type":19,"tag":168,"props":1150,"children":1151},{"style":313},[1152],{"type":24,"value":1098},{"type":19,"tag":168,"props":1154,"children":1155},{"style":175},[1156],{"type":24,"value":818},{"type":19,"tag":168,"props":1158,"children":1159},{"style":313},[1160],{"type":24,"value":823},{"type":19,"tag":168,"props":1162,"children":1163},{"style":826},[1164],{"type":24,"value":1165},"AutoEncryptSharedLibrary",{"type":19,"tag":168,"props":1167,"children":1168},{"style":313},[1169],{"type":24,"value":1170},",\n",{"type":19,"tag":168,"props":1172,"children":1174},{"class":170,"line":1173},11,[1175,1180,1184,1188,1192,1196,1201,1205],{"type":19,"tag":168,"props":1176,"children":1177},{"style":434},[1178],{"type":24,"value":1179},"                           \"",{"type":19,"tag":168,"props":1181,"children":1182},{"style":440},[1183],{"type":24,"value":842},{"type":19,"tag":168,"props":1185,"children":1186},{"style":845},[1187],{"type":24,"value":848},{"type":19,"tag":168,"props":1189,"children":1190},{"style":440},[1191],{"type":24,"value":14},{"type":19,"tag":168,"props":1193,"children":1194},{"style":845},[1195],{"type":24,"value":848},{"type":19,"tag":168,"props":1197,"children":1198},{"style":440},[1199],{"type":24,"value":1200},"mongo_crypt_v1.dll",{"type":19,"tag":168,"props":1202,"children":1203},{"style":434},[1204],{"type":24,"value":437},{"type":19,"tag":168,"props":1206,"children":1207},{"style":313},[1208],{"type":24,"value":1209},")\n",{"type":19,"tag":168,"props":1211,"children":1213},{"class":170,"line":1212},12,[1214,1218,1223],{"type":19,"tag":168,"props":1215,"children":1216},{"style":313},[1217],{"type":24,"value":1098},{"type":19,"tag":168,"props":1219,"children":1220},{"style":175},[1221],{"type":24,"value":1222},"WithKmsProviders",{"type":19,"tag":168,"props":1224,"children":1225},{"style":313},[1226],{"type":24,"value":1227},"(kmsProviders));\n",{"type":19,"tag":20,"props":1229,"children":1230},{},[1231,1233,1238,1240,1246,1248,1254],{"type":24,"value":1232},"If you are using Linux or Mac OS ensure that your ",{"type":19,"tag":34,"props":1234,"children":1236},{"className":1235},[],[1237],{"type":24,"value":818},{"type":24,"value":1239}," path points to the necessary ",{"type":19,"tag":34,"props":1241,"children":1243},{"className":1242},[],[1244],{"type":24,"value":1245},".so",{"type":24,"value":1247}," or ",{"type":19,"tag":34,"props":1249,"children":1251},{"className":1250},[],[1252],{"type":24,"value":1253},".dylib",{"type":24,"value":1255}," binary for your platform.",{"type":19,"tag":128,"props":1257,"children":1259},{"id":1258},"configuring-field-encryption",[1260],{"type":24,"value":1261},"Configuring field encryption",{"type":19,"tag":20,"props":1263,"children":1264},{},[1265,1267,1273],{"type":24,"value":1266},"Let's start with a simple ",{"type":19,"tag":34,"props":1268,"children":1270},{"className":1269},[],[1271],{"type":24,"value":1272},"Employee",{"type":24,"value":1274}," entity that contains some sensitive information we want to encrypt:",{"type":19,"tag":157,"props":1276,"children":1278},{"className":301,"code":1277,"language":303,"meta":162,"style":162},"public class Employee\n{\n    public ObjectId Id { get; set; }\n    public string Name { get; set; }\n    public string TaxPayerId { get; set; }\n    public decimal Salary { get; set; }\n    public string Notes { get; set; }\n}\n",[1279],{"type":19,"tag":34,"props":1280,"children":1281},{"__ignoreMap":162},[1282,1301,1308,1346,1378,1410,1443,1475],{"type":19,"tag":168,"props":1283,"children":1284},{"class":170,"line":171},[1285,1290,1295],{"type":19,"tag":168,"props":1286,"children":1287},{"style":414},[1288],{"type":24,"value":1289},"public",{"type":19,"tag":168,"props":1291,"children":1292},{"style":482},[1293],{"type":24,"value":1294}," class",{"type":19,"tag":168,"props":1296,"children":1298},{"style":1297},"--shiki-default:#3A94C5;--shiki-dark:#8BE9FD",[1299],{"type":24,"value":1300}," Employee\n",{"type":19,"tag":168,"props":1302,"children":1303},{"class":170,"line":455},[1304],{"type":19,"tag":168,"props":1305,"children":1306},{"style":313},[1307],{"type":24,"value":542},{"type":19,"tag":168,"props":1309,"children":1310},{"class":170,"line":465},[1311,1316,1321,1326,1331,1336,1341],{"type":19,"tag":168,"props":1312,"children":1313},{"style":414},[1314],{"type":24,"value":1315},"    public",{"type":19,"tag":168,"props":1317,"children":1318},{"style":488},[1319],{"type":24,"value":1320}," ObjectId",{"type":19,"tag":168,"props":1322,"children":1323},{"style":313},[1324],{"type":24,"value":1325}," Id { ",{"type":19,"tag":168,"props":1327,"children":1328},{"style":403},[1329],{"type":24,"value":1330},"get",{"type":19,"tag":168,"props":1332,"children":1333},{"style":313},[1334],{"type":24,"value":1335},"; ",{"type":19,"tag":168,"props":1337,"children":1338},{"style":403},[1339],{"type":24,"value":1340},"set",{"type":19,"tag":168,"props":1342,"children":1343},{"style":313},[1344],{"type":24,"value":1345},"; }\n",{"type":19,"tag":168,"props":1347,"children":1348},{"class":170,"line":536},[1349,1353,1357,1362,1366,1370,1374],{"type":19,"tag":168,"props":1350,"children":1351},{"style":414},[1352],{"type":24,"value":1315},{"type":19,"tag":168,"props":1354,"children":1355},{"style":403},[1356],{"type":24,"value":668},{"type":19,"tag":168,"props":1358,"children":1359},{"style":313},[1360],{"type":24,"value":1361}," Name { ",{"type":19,"tag":168,"props":1363,"children":1364},{"style":403},[1365],{"type":24,"value":1330},{"type":19,"tag":168,"props":1367,"children":1368},{"style":313},[1369],{"type":24,"value":1335},{"type":19,"tag":168,"props":1371,"children":1372},{"style":403},[1373],{"type":24,"value":1340},{"type":19,"tag":168,"props":1375,"children":1376},{"style":313},[1377],{"type":24,"value":1345},{"type":19,"tag":168,"props":1379,"children":1380},{"class":170,"line":545},[1381,1385,1389,1394,1398,1402,1406],{"type":19,"tag":168,"props":1382,"children":1383},{"style":414},[1384],{"type":24,"value":1315},{"type":19,"tag":168,"props":1386,"children":1387},{"style":403},[1388],{"type":24,"value":668},{"type":19,"tag":168,"props":1390,"children":1391},{"style":313},[1392],{"type":24,"value":1393}," TaxPayerId { ",{"type":19,"tag":168,"props":1395,"children":1396},{"style":403},[1397],{"type":24,"value":1330},{"type":19,"tag":168,"props":1399,"children":1400},{"style":313},[1401],{"type":24,"value":1335},{"type":19,"tag":168,"props":1403,"children":1404},{"style":403},[1405],{"type":24,"value":1340},{"type":19,"tag":168,"props":1407,"children":1408},{"style":313},[1409],{"type":24,"value":1345},{"type":19,"tag":168,"props":1411,"children":1412},{"class":170,"line":618},[1413,1417,1422,1427,1431,1435,1439],{"type":19,"tag":168,"props":1414,"children":1415},{"style":414},[1416],{"type":24,"value":1315},{"type":19,"tag":168,"props":1418,"children":1419},{"style":403},[1420],{"type":24,"value":1421}," decimal",{"type":19,"tag":168,"props":1423,"children":1424},{"style":313},[1425],{"type":24,"value":1426}," Salary { ",{"type":19,"tag":168,"props":1428,"children":1429},{"style":403},[1430],{"type":24,"value":1330},{"type":19,"tag":168,"props":1432,"children":1433},{"style":313},[1434],{"type":24,"value":1335},{"type":19,"tag":168,"props":1436,"children":1437},{"style":403},[1438],{"type":24,"value":1340},{"type":19,"tag":168,"props":1440,"children":1441},{"style":313},[1442],{"type":24,"value":1345},{"type":19,"tag":168,"props":1444,"children":1445},{"class":170,"line":1092},[1446,1450,1454,1459,1463,1467,1471],{"type":19,"tag":168,"props":1447,"children":1448},{"style":414},[1449],{"type":24,"value":1315},{"type":19,"tag":168,"props":1451,"children":1452},{"style":403},[1453],{"type":24,"value":668},{"type":19,"tag":168,"props":1455,"children":1456},{"style":313},[1457],{"type":24,"value":1458}," Notes { ",{"type":19,"tag":168,"props":1460,"children":1461},{"style":403},[1462],{"type":24,"value":1330},{"type":19,"tag":168,"props":1464,"children":1465},{"style":313},[1466],{"type":24,"value":1335},{"type":19,"tag":168,"props":1468,"children":1469},{"style":403},[1470],{"type":24,"value":1340},{"type":19,"tag":168,"props":1472,"children":1473},{"style":313},[1474],{"type":24,"value":1345},{"type":19,"tag":168,"props":1476,"children":1477},{"class":170,"line":1111},[1478],{"type":19,"tag":168,"props":1479,"children":1480},{"style":313},[1481],{"type":24,"value":1482},"}\n",{"type":19,"tag":20,"props":1484,"children":1485},{},[1486],{"type":24,"value":1487},"We want to encrypt two properties here so we'll need to generate two Data Encryption Keys we can use. Like when we generated the Customer Master Key we will write some one-time code to generate them in our key vault and we'll output the necessary GUIDs to reference them from our app.",{"type":19,"tag":157,"props":1489,"children":1491},{"className":301,"code":1490,"language":303,"meta":162,"style":162},"using var clientEncryption = new ClientEncryption(\n    new ClientEncryptionOptions(new MongoClient(clientSettings), keyVaultNamespace, kmsProviders));\n\nGuid CreateDataKey() => clientEncryption.CreateDataKey(\"local\", new DataKeyOptions(), CancellationToken.None);\nConsole.WriteLine(String.Join(\"\\n\", Enumerable.Range(1, 3).Select(_ => CreateDataKey())));\n",[1492],{"type":19,"tag":34,"props":1493,"children":1494},{"__ignoreMap":162},[1495,1531,1562,1569,1645],{"type":19,"tag":168,"props":1496,"children":1497},{"class":170,"line":171},[1498,1503,1508,1513,1517,1521,1526],{"type":19,"tag":168,"props":1499,"children":1500},{"style":482},[1501],{"type":24,"value":1502},"using",{"type":19,"tag":168,"props":1504,"children":1505},{"style":403},[1506],{"type":24,"value":1507}," var",{"type":19,"tag":168,"props":1509,"children":1510},{"style":313},[1511],{"type":24,"value":1512}," clientEncryption ",{"type":19,"tag":168,"props":1514,"children":1515},{"style":414},[1516],{"type":24,"value":417},{"type":19,"tag":168,"props":1518,"children":1519},{"style":482},[1520],{"type":24,"value":485},{"type":19,"tag":168,"props":1522,"children":1523},{"style":488},[1524],{"type":24,"value":1525}," ClientEncryption",{"type":19,"tag":168,"props":1527,"children":1528},{"style":313},[1529],{"type":24,"value":1530},"(\n",{"type":19,"tag":168,"props":1532,"children":1533},{"class":170,"line":455},[1534,1539,1544,1548,1552,1557],{"type":19,"tag":168,"props":1535,"children":1536},{"style":482},[1537],{"type":24,"value":1538},"    new",{"type":19,"tag":168,"props":1540,"children":1541},{"style":488},[1542],{"type":24,"value":1543}," ClientEncryptionOptions",{"type":19,"tag":168,"props":1545,"children":1546},{"style":313},[1547],{"type":24,"value":346},{"type":19,"tag":168,"props":1549,"children":1550},{"style":482},[1551],{"type":24,"value":572},{"type":19,"tag":168,"props":1553,"children":1554},{"style":488},[1555],{"type":24,"value":1556}," MongoClient",{"type":19,"tag":168,"props":1558,"children":1559},{"style":313},[1560],{"type":24,"value":1561},"(clientSettings), keyVaultNamespace, kmsProviders));\n",{"type":19,"tag":168,"props":1563,"children":1564},{"class":170,"line":465},[1565],{"type":19,"tag":168,"props":1566,"children":1567},{"emptyLinePlaceholder":459},[1568],{"type":24,"value":462},{"type":19,"tag":168,"props":1570,"children":1571},{"class":170,"line":536},[1572,1577,1582,1587,1592,1597,1602,1606,1610,1614,1618,1622,1626,1631,1636,1641],{"type":19,"tag":168,"props":1573,"children":1574},{"style":488},[1575],{"type":24,"value":1576},"Guid",{"type":19,"tag":168,"props":1578,"children":1579},{"style":175},[1580],{"type":24,"value":1581}," CreateDataKey",{"type":19,"tag":168,"props":1583,"children":1584},{"style":313},[1585],{"type":24,"value":1586},"() ",{"type":19,"tag":168,"props":1588,"children":1589},{"style":414},[1590],{"type":24,"value":1591},"=>",{"type":19,"tag":168,"props":1593,"children":1594},{"style":313},[1595],{"type":24,"value":1596}," clientEncryption.",{"type":19,"tag":168,"props":1598,"children":1599},{"style":175},[1600],{"type":24,"value":1601},"CreateDataKey",{"type":19,"tag":168,"props":1603,"children":1604},{"style":313},[1605],{"type":24,"value":346},{"type":19,"tag":168,"props":1607,"children":1608},{"style":434},[1609],{"type":24,"value":437},{"type":19,"tag":168,"props":1611,"children":1612},{"style":440},[1613],{"type":24,"value":388},{"type":19,"tag":168,"props":1615,"children":1616},{"style":434},[1617],{"type":24,"value":437},{"type":19,"tag":168,"props":1619,"children":1620},{"style":313},[1621],{"type":24,"value":506},{"type":19,"tag":168,"props":1623,"children":1624},{"style":482},[1625],{"type":24,"value":572},{"type":19,"tag":168,"props":1627,"children":1628},{"style":488},[1629],{"type":24,"value":1630}," DataKeyOptions",{"type":19,"tag":168,"props":1632,"children":1633},{"style":313},[1634],{"type":24,"value":1635},"(), CancellationToken.",{"type":19,"tag":168,"props":1637,"children":1638},{"style":826},[1639],{"type":24,"value":1640},"None",{"type":19,"tag":168,"props":1642,"children":1643},{"style":313},[1644],{"type":24,"value":452},{"type":19,"tag":168,"props":1646,"children":1647},{"class":170,"line":545},[1648,1652,1656,1661,1666,1670,1674,1679,1683,1688,1693,1697,1702,1706,1711,1716,1721,1725,1731,1736,1740],{"type":19,"tag":168,"props":1649,"children":1650},{"style":313},[1651],{"type":24,"value":316},{"type":19,"tag":168,"props":1653,"children":1654},{"style":175},[1655],{"type":24,"value":321},{"type":19,"tag":168,"props":1657,"children":1658},{"style":313},[1659],{"type":24,"value":1660},"(String.",{"type":19,"tag":168,"props":1662,"children":1663},{"style":175},[1664],{"type":24,"value":1665},"Join",{"type":19,"tag":168,"props":1667,"children":1668},{"style":313},[1669],{"type":24,"value":346},{"type":19,"tag":168,"props":1671,"children":1672},{"style":434},[1673],{"type":24,"value":437},{"type":19,"tag":168,"props":1675,"children":1676},{"style":845},[1677],{"type":24,"value":1678},"\\n",{"type":19,"tag":168,"props":1680,"children":1681},{"style":434},[1682],{"type":24,"value":437},{"type":19,"tag":168,"props":1684,"children":1685},{"style":313},[1686],{"type":24,"value":1687},", Enumerable.",{"type":19,"tag":168,"props":1689,"children":1690},{"style":175},[1691],{"type":24,"value":1692},"Range",{"type":19,"tag":168,"props":1694,"children":1695},{"style":313},[1696],{"type":24,"value":346},{"type":19,"tag":168,"props":1698,"children":1699},{"style":349},[1700],{"type":24,"value":1701},"1",{"type":19,"tag":168,"props":1703,"children":1704},{"style":313},[1705],{"type":24,"value":506},{"type":19,"tag":168,"props":1707,"children":1708},{"style":349},[1709],{"type":24,"value":1710},"3",{"type":19,"tag":168,"props":1712,"children":1713},{"style":313},[1714],{"type":24,"value":1715},").",{"type":19,"tag":168,"props":1717,"children":1718},{"style":175},[1719],{"type":24,"value":1720},"Select",{"type":19,"tag":168,"props":1722,"children":1723},{"style":313},[1724],{"type":24,"value":346},{"type":19,"tag":168,"props":1726,"children":1728},{"style":1727},"--shiki-default:#5C6A72;--shiki-default-font-style:inherit;--shiki-dark:#FFB86C;--shiki-dark-font-style:italic",[1729],{"type":24,"value":1730},"_",{"type":19,"tag":168,"props":1732,"children":1733},{"style":414},[1734],{"type":24,"value":1735}," =>",{"type":19,"tag":168,"props":1737,"children":1738},{"style":175},[1739],{"type":24,"value":1581},{"type":19,"tag":168,"props":1741,"children":1742},{"style":313},[1743],{"type":24,"value":1744},"())));\n",{"type":19,"tag":20,"props":1746,"children":1747},{},[1748],{"type":24,"value":1749},"These two GUIDs can now be referenced in our fluent EF API to enable the encryption on the properties. (We hope to automate key generation in a future EF Core Provider update). If you delete the database or the key vault collection then you will lose the ability to read your encrypted data!",{"type":19,"tag":20,"props":1751,"children":1752},{},[1753,1755,1761,1763,1769,1771,1777,1779,1785],{"type":24,"value":1754},"We can now configure encryption using EF Core's fluent API in our ",{"type":19,"tag":34,"props":1756,"children":1758},{"className":1757},[],[1759],{"type":24,"value":1760},"OnModelCreating",{"type":24,"value":1762}," method. For properties you want to query with equality operations, use ",{"type":19,"tag":34,"props":1764,"children":1766},{"className":1765},[],[1767],{"type":24,"value":1768},"IsEncryptedForEquality",{"type":24,"value":1770},". For numeric properties where you need range queries, use ",{"type":19,"tag":34,"props":1772,"children":1774},{"className":1773},[],[1775],{"type":24,"value":1776},"IsEncryptedForRange",{"type":24,"value":1778}," and specify the min/max bounds and precision. Alternatively you can encrypt with ",{"type":19,"tag":34,"props":1780,"children":1782},{"className":1781},[],[1783],{"type":24,"value":1784},"IsEncrypted",{"type":24,"value":1786}," if you just want non-queryable encryption for things like sub-documents and objects.",{"type":19,"tag":20,"props":1788,"children":1789},{},[1790],{"type":24,"value":1791},"So let's go ahead and add create a data context with the fluent configuration for these properties:",{"type":19,"tag":157,"props":1793,"children":1795},{"className":301,"code":1794,"language":303,"meta":162,"style":162},"public class MyContext(DbContextOptions options) : DbContext(options)\n{\n    public DbSet\u003CEmployee> Employees { get; set; }\n\n    protected override void OnModelCreating(ModelBuilder modelBuilder)\n    {\n        modelBuilder.Entity\u003CEmployee>(entity =>\n        {\n            entity.Property(e => e.TaxPayerId)\n                // Might want to look-up by Tax Payer ID\n                .IsEncryptedForEquality(Guid.Parse(\"adfcb376-16b2-4325-b0bd-1e7811d0ce6b\"));\n\n            entity.Property(e => e.Salary)\n                .HasBsonRepresentation(BsonType.Decimal128)\n                // Salaries from 0 to 10 million, no decimal place precision\n                .IsEncryptedForRange(0m, 10000000m, 0,\n                    Guid.Parse(\"e1c70f05-d0f9-41c5-938e-059632b33d09\"));\n\n            entity.Property(e => e.Notes)\n                // This is encrypted and readable but you can't query on it\n                .IsEncrypted(Guid.Parse(\"f10e6bb1-833f-46ee-adc7-62946c7906a7\"));\n        });\n    }\n}\n",[1796],{"type":19,"tag":34,"props":1797,"children":1798},{"__ignoreMap":162},[1799,1852,1859,1900,1907,1948,1956,1992,2000,2040,2048,2092,2099,2136,2163,2172,2215,2249,2257,2294,2303,2344,2353,2362],{"type":19,"tag":168,"props":1800,"children":1801},{"class":170,"line":171},[1802,1806,1810,1815,1819,1824,1829,1834,1839,1843,1848],{"type":19,"tag":168,"props":1803,"children":1804},{"style":414},[1805],{"type":24,"value":1289},{"type":19,"tag":168,"props":1807,"children":1808},{"style":482},[1809],{"type":24,"value":1294},{"type":19,"tag":168,"props":1811,"children":1812},{"style":1297},[1813],{"type":24,"value":1814}," MyContext",{"type":19,"tag":168,"props":1816,"children":1817},{"style":313},[1818],{"type":24,"value":346},{"type":19,"tag":168,"props":1820,"children":1821},{"style":488},[1822],{"type":24,"value":1823},"DbContextOptions",{"type":19,"tag":168,"props":1825,"children":1826},{"style":1727},[1827],{"type":24,"value":1828}," options",{"type":19,"tag":168,"props":1830,"children":1831},{"style":313},[1832],{"type":24,"value":1833},") : ",{"type":19,"tag":168,"props":1835,"children":1836},{"style":488},[1837],{"type":24,"value":1838},"DbContext",{"type":19,"tag":168,"props":1840,"children":1841},{"style":313},[1842],{"type":24,"value":346},{"type":19,"tag":168,"props":1844,"children":1845},{"style":488},[1846],{"type":24,"value":1847},"options",{"type":19,"tag":168,"props":1849,"children":1850},{"style":313},[1851],{"type":24,"value":1209},{"type":19,"tag":168,"props":1853,"children":1854},{"class":170,"line":455},[1855],{"type":19,"tag":168,"props":1856,"children":1857},{"style":313},[1858],{"type":24,"value":542},{"type":19,"tag":168,"props":1860,"children":1861},{"class":170,"line":465},[1862,1866,1871,1875,1879,1884,1888,1892,1896],{"type":19,"tag":168,"props":1863,"children":1864},{"style":414},[1865],{"type":24,"value":1315},{"type":19,"tag":168,"props":1867,"children":1868},{"style":488},[1869],{"type":24,"value":1870}," DbSet",{"type":19,"tag":168,"props":1872,"children":1873},{"style":313},[1874],{"type":24,"value":496},{"type":19,"tag":168,"props":1876,"children":1877},{"style":488},[1878],{"type":24,"value":1272},{"type":19,"tag":168,"props":1880,"children":1881},{"style":313},[1882],{"type":24,"value":1883},"> Employees { ",{"type":19,"tag":168,"props":1885,"children":1886},{"style":403},[1887],{"type":24,"value":1330},{"type":19,"tag":168,"props":1889,"children":1890},{"style":313},[1891],{"type":24,"value":1335},{"type":19,"tag":168,"props":1893,"children":1894},{"style":403},[1895],{"type":24,"value":1340},{"type":19,"tag":168,"props":1897,"children":1898},{"style":313},[1899],{"type":24,"value":1345},{"type":19,"tag":168,"props":1901,"children":1902},{"class":170,"line":536},[1903],{"type":19,"tag":168,"props":1904,"children":1905},{"emptyLinePlaceholder":459},[1906],{"type":24,"value":462},{"type":19,"tag":168,"props":1908,"children":1909},{"class":170,"line":545},[1910,1915,1920,1925,1930,1934,1939,1944],{"type":19,"tag":168,"props":1911,"children":1912},{"style":414},[1913],{"type":24,"value":1914},"    protected",{"type":19,"tag":168,"props":1916,"children":1917},{"style":414},[1918],{"type":24,"value":1919}," override",{"type":19,"tag":168,"props":1921,"children":1922},{"style":403},[1923],{"type":24,"value":1924}," void",{"type":19,"tag":168,"props":1926,"children":1927},{"style":175},[1928],{"type":24,"value":1929}," OnModelCreating",{"type":19,"tag":168,"props":1931,"children":1932},{"style":313},[1933],{"type":24,"value":346},{"type":19,"tag":168,"props":1935,"children":1936},{"style":488},[1937],{"type":24,"value":1938},"ModelBuilder",{"type":19,"tag":168,"props":1940,"children":1941},{"style":1727},[1942],{"type":24,"value":1943}," modelBuilder",{"type":19,"tag":168,"props":1945,"children":1946},{"style":313},[1947],{"type":24,"value":1209},{"type":19,"tag":168,"props":1949,"children":1950},{"class":170,"line":618},[1951],{"type":19,"tag":168,"props":1952,"children":1953},{"style":313},[1954],{"type":24,"value":1955},"    {\n",{"type":19,"tag":168,"props":1957,"children":1958},{"class":170,"line":1092},[1959,1964,1969,1973,1977,1982,1987],{"type":19,"tag":168,"props":1960,"children":1961},{"style":313},[1962],{"type":24,"value":1963},"        modelBuilder.",{"type":19,"tag":168,"props":1965,"children":1966},{"style":175},[1967],{"type":24,"value":1968},"Entity",{"type":19,"tag":168,"props":1970,"children":1971},{"style":313},[1972],{"type":24,"value":496},{"type":19,"tag":168,"props":1974,"children":1975},{"style":488},[1976],{"type":24,"value":1272},{"type":19,"tag":168,"props":1978,"children":1979},{"style":313},[1980],{"type":24,"value":1981},">(",{"type":19,"tag":168,"props":1983,"children":1984},{"style":1727},[1985],{"type":24,"value":1986},"entity",{"type":19,"tag":168,"props":1988,"children":1989},{"style":414},[1990],{"type":24,"value":1991}," =>\n",{"type":19,"tag":168,"props":1993,"children":1994},{"class":170,"line":1111},[1995],{"type":19,"tag":168,"props":1996,"children":1997},{"style":313},[1998],{"type":24,"value":1999},"        {\n",{"type":19,"tag":168,"props":2001,"children":2002},{"class":170,"line":1129},[2003,2008,2013,2017,2022,2026,2031,2036],{"type":19,"tag":168,"props":2004,"children":2005},{"style":313},[2006],{"type":24,"value":2007},"            entity.",{"type":19,"tag":168,"props":2009,"children":2010},{"style":175},[2011],{"type":24,"value":2012},"Property",{"type":19,"tag":168,"props":2014,"children":2015},{"style":313},[2016],{"type":24,"value":346},{"type":19,"tag":168,"props":2018,"children":2019},{"style":1727},[2020],{"type":24,"value":2021},"e",{"type":19,"tag":168,"props":2023,"children":2024},{"style":414},[2025],{"type":24,"value":1735},{"type":19,"tag":168,"props":2027,"children":2028},{"style":313},[2029],{"type":24,"value":2030}," e.",{"type":19,"tag":168,"props":2032,"children":2033},{"style":826},[2034],{"type":24,"value":2035},"TaxPayerId",{"type":19,"tag":168,"props":2037,"children":2038},{"style":313},[2039],{"type":24,"value":1209},{"type":19,"tag":168,"props":2041,"children":2042},{"class":170,"line":1147},[2043],{"type":19,"tag":168,"props":2044,"children":2045},{"style":864},[2046],{"type":24,"value":2047},"                // Might want to look-up by Tax Payer ID\n",{"type":19,"tag":168,"props":2049,"children":2050},{"class":170,"line":1173},[2051,2056,2060,2065,2070,2074,2078,2083,2087],{"type":19,"tag":168,"props":2052,"children":2053},{"style":313},[2054],{"type":24,"value":2055},"                .",{"type":19,"tag":168,"props":2057,"children":2058},{"style":175},[2059],{"type":24,"value":1768},{"type":19,"tag":168,"props":2061,"children":2062},{"style":313},[2063],{"type":24,"value":2064},"(Guid.",{"type":19,"tag":168,"props":2066,"children":2067},{"style":175},[2068],{"type":24,"value":2069},"Parse",{"type":19,"tag":168,"props":2071,"children":2072},{"style":313},[2073],{"type":24,"value":346},{"type":19,"tag":168,"props":2075,"children":2076},{"style":434},[2077],{"type":24,"value":437},{"type":19,"tag":168,"props":2079,"children":2080},{"style":440},[2081],{"type":24,"value":2082},"adfcb376-16b2-4325-b0bd-1e7811d0ce6b",{"type":19,"tag":168,"props":2084,"children":2085},{"style":434},[2086],{"type":24,"value":437},{"type":19,"tag":168,"props":2088,"children":2089},{"style":313},[2090],{"type":24,"value":2091},"));\n",{"type":19,"tag":168,"props":2093,"children":2094},{"class":170,"line":1212},[2095],{"type":19,"tag":168,"props":2096,"children":2097},{"emptyLinePlaceholder":459},[2098],{"type":24,"value":462},{"type":19,"tag":168,"props":2100,"children":2102},{"class":170,"line":2101},13,[2103,2107,2111,2115,2119,2123,2127,2132],{"type":19,"tag":168,"props":2104,"children":2105},{"style":313},[2106],{"type":24,"value":2007},{"type":19,"tag":168,"props":2108,"children":2109},{"style":175},[2110],{"type":24,"value":2012},{"type":19,"tag":168,"props":2112,"children":2113},{"style":313},[2114],{"type":24,"value":346},{"type":19,"tag":168,"props":2116,"children":2117},{"style":1727},[2118],{"type":24,"value":2021},{"type":19,"tag":168,"props":2120,"children":2121},{"style":414},[2122],{"type":24,"value":1735},{"type":19,"tag":168,"props":2124,"children":2125},{"style":313},[2126],{"type":24,"value":2030},{"type":19,"tag":168,"props":2128,"children":2129},{"style":826},[2130],{"type":24,"value":2131},"Salary",{"type":19,"tag":168,"props":2133,"children":2134},{"style":313},[2135],{"type":24,"value":1209},{"type":19,"tag":168,"props":2137,"children":2139},{"class":170,"line":2138},14,[2140,2144,2149,2154,2159],{"type":19,"tag":168,"props":2141,"children":2142},{"style":313},[2143],{"type":24,"value":2055},{"type":19,"tag":168,"props":2145,"children":2146},{"style":175},[2147],{"type":24,"value":2148},"HasBsonRepresentation",{"type":19,"tag":168,"props":2150,"children":2151},{"style":313},[2152],{"type":24,"value":2153},"(BsonType.",{"type":19,"tag":168,"props":2155,"children":2156},{"style":826},[2157],{"type":24,"value":2158},"Decimal128",{"type":19,"tag":168,"props":2160,"children":2161},{"style":313},[2162],{"type":24,"value":1209},{"type":19,"tag":168,"props":2164,"children":2166},{"class":170,"line":2165},15,[2167],{"type":19,"tag":168,"props":2168,"children":2169},{"style":864},[2170],{"type":24,"value":2171},"                // Salaries from 0 to 10 million, no decimal place precision\n",{"type":19,"tag":168,"props":2173,"children":2175},{"class":170,"line":2174},16,[2176,2180,2184,2188,2193,2197,2202,2206,2211],{"type":19,"tag":168,"props":2177,"children":2178},{"style":313},[2179],{"type":24,"value":2055},{"type":19,"tag":168,"props":2181,"children":2182},{"style":175},[2183],{"type":24,"value":1776},{"type":19,"tag":168,"props":2185,"children":2186},{"style":313},[2187],{"type":24,"value":346},{"type":19,"tag":168,"props":2189,"children":2190},{"style":349},[2191],{"type":24,"value":2192},"0m",{"type":19,"tag":168,"props":2194,"children":2195},{"style":313},[2196],{"type":24,"value":506},{"type":19,"tag":168,"props":2198,"children":2199},{"style":349},[2200],{"type":24,"value":2201},"10000000m",{"type":19,"tag":168,"props":2203,"children":2204},{"style":313},[2205],{"type":24,"value":506},{"type":19,"tag":168,"props":2207,"children":2208},{"style":349},[2209],{"type":24,"value":2210},"0",{"type":19,"tag":168,"props":2212,"children":2213},{"style":313},[2214],{"type":24,"value":1170},{"type":19,"tag":168,"props":2216,"children":2218},{"class":170,"line":2217},17,[2219,2224,2228,2232,2236,2241,2245],{"type":19,"tag":168,"props":2220,"children":2221},{"style":313},[2222],{"type":24,"value":2223},"                    Guid.",{"type":19,"tag":168,"props":2225,"children":2226},{"style":175},[2227],{"type":24,"value":2069},{"type":19,"tag":168,"props":2229,"children":2230},{"style":313},[2231],{"type":24,"value":346},{"type":19,"tag":168,"props":2233,"children":2234},{"style":434},[2235],{"type":24,"value":437},{"type":19,"tag":168,"props":2237,"children":2238},{"style":440},[2239],{"type":24,"value":2240},"e1c70f05-d0f9-41c5-938e-059632b33d09",{"type":19,"tag":168,"props":2242,"children":2243},{"style":434},[2244],{"type":24,"value":437},{"type":19,"tag":168,"props":2246,"children":2247},{"style":313},[2248],{"type":24,"value":2091},{"type":19,"tag":168,"props":2250,"children":2252},{"class":170,"line":2251},18,[2253],{"type":19,"tag":168,"props":2254,"children":2255},{"emptyLinePlaceholder":459},[2256],{"type":24,"value":462},{"type":19,"tag":168,"props":2258,"children":2260},{"class":170,"line":2259},19,[2261,2265,2269,2273,2277,2281,2285,2290],{"type":19,"tag":168,"props":2262,"children":2263},{"style":313},[2264],{"type":24,"value":2007},{"type":19,"tag":168,"props":2266,"children":2267},{"style":175},[2268],{"type":24,"value":2012},{"type":19,"tag":168,"props":2270,"children":2271},{"style":313},[2272],{"type":24,"value":346},{"type":19,"tag":168,"props":2274,"children":2275},{"style":1727},[2276],{"type":24,"value":2021},{"type":19,"tag":168,"props":2278,"children":2279},{"style":414},[2280],{"type":24,"value":1735},{"type":19,"tag":168,"props":2282,"children":2283},{"style":313},[2284],{"type":24,"value":2030},{"type":19,"tag":168,"props":2286,"children":2287},{"style":826},[2288],{"type":24,"value":2289},"Notes",{"type":19,"tag":168,"props":2291,"children":2292},{"style":313},[2293],{"type":24,"value":1209},{"type":19,"tag":168,"props":2295,"children":2297},{"class":170,"line":2296},20,[2298],{"type":19,"tag":168,"props":2299,"children":2300},{"style":864},[2301],{"type":24,"value":2302},"                // This is encrypted and readable but you can't query on it\n",{"type":19,"tag":168,"props":2304,"children":2306},{"class":170,"line":2305},21,[2307,2311,2315,2319,2323,2327,2331,2336,2340],{"type":19,"tag":168,"props":2308,"children":2309},{"style":313},[2310],{"type":24,"value":2055},{"type":19,"tag":168,"props":2312,"children":2313},{"style":175},[2314],{"type":24,"value":1784},{"type":19,"tag":168,"props":2316,"children":2317},{"style":313},[2318],{"type":24,"value":2064},{"type":19,"tag":168,"props":2320,"children":2321},{"style":175},[2322],{"type":24,"value":2069},{"type":19,"tag":168,"props":2324,"children":2325},{"style":313},[2326],{"type":24,"value":346},{"type":19,"tag":168,"props":2328,"children":2329},{"style":434},[2330],{"type":24,"value":437},{"type":19,"tag":168,"props":2332,"children":2333},{"style":440},[2334],{"type":24,"value":2335},"f10e6bb1-833f-46ee-adc7-62946c7906a7",{"type":19,"tag":168,"props":2337,"children":2338},{"style":434},[2339],{"type":24,"value":437},{"type":19,"tag":168,"props":2341,"children":2342},{"style":313},[2343],{"type":24,"value":2091},{"type":19,"tag":168,"props":2345,"children":2347},{"class":170,"line":2346},22,[2348],{"type":19,"tag":168,"props":2349,"children":2350},{"style":313},[2351],{"type":24,"value":2352},"        });\n",{"type":19,"tag":168,"props":2354,"children":2356},{"class":170,"line":2355},23,[2357],{"type":19,"tag":168,"props":2358,"children":2359},{"style":313},[2360],{"type":24,"value":2361},"    }\n",{"type":19,"tag":168,"props":2363,"children":2365},{"class":170,"line":2364},24,[2366],{"type":19,"tag":168,"props":2367,"children":2368},{"style":313},[2369],{"type":24,"value":1482},{"type":19,"tag":128,"props":2371,"children":2373},{"id":2372},"adding-some-encrypted-test-data",[2374],{"type":24,"value":2375},"Adding some encrypted test data",{"type":19,"tag":20,"props":2377,"children":2378},{},[2379,2381,2387,2388,2394],{"type":24,"value":2380},"Now that you have configured your queryable encrypted fields feel free to use EF to add some data to the database using the regular ",{"type":19,"tag":34,"props":2382,"children":2384},{"className":2383},[],[2385],{"type":24,"value":2386},".Add",{"type":24,"value":93},{"type":19,"tag":34,"props":2389,"children":2391},{"className":2390},[],[2392],{"type":24,"value":2393},".SaveChanges",{"type":24,"value":2395}," methods:",{"type":19,"tag":157,"props":2397,"children":2399},{"className":301,"code":2398,"language":303,"meta":162,"style":162},"if (!await db.Employees.AnyAsync())\n{\n    // Setup initial test data\n    db.Employees.AddRange(\n        new Employee { Name = \"Tom\", TaxPayerId = \"12345\", Salary = 50000, Notes = \"\" },\n        new Employee { Name = \"Dick\", TaxPayerId = \"23456\", Salary = 100000, Notes = \"Very busy\" },\n        new Employee { Name = \"Sally\", TaxPayerId = \"34567\", Salary = 199000, Notes = \"Afternoons\" },\n        new Employee { Name = \"Harry\", TaxPayerId = \"45678\", Salary = 200000, Notes = \"Weekends\" });\n    await db.SaveChangesAsync();\n}\n",[2400],{"type":19,"tag":34,"props":2401,"children":2402},{"__ignoreMap":162},[2403,2450,2457,2465,2490,2580,2671,2762,2854,2875],{"type":19,"tag":168,"props":2404,"children":2405},{"class":170,"line":171},[2406,2411,2416,2421,2426,2431,2436,2440,2445],{"type":19,"tag":168,"props":2407,"children":2408},{"style":482},[2409],{"type":24,"value":2410},"if",{"type":19,"tag":168,"props":2412,"children":2413},{"style":313},[2414],{"type":24,"value":2415}," (",{"type":19,"tag":168,"props":2417,"children":2418},{"style":414},[2419],{"type":24,"value":2420},"!",{"type":19,"tag":168,"props":2422,"children":2423},{"style":482},[2424],{"type":24,"value":2425},"await",{"type":19,"tag":168,"props":2427,"children":2428},{"style":313},[2429],{"type":24,"value":2430}," db.",{"type":19,"tag":168,"props":2432,"children":2433},{"style":826},[2434],{"type":24,"value":2435},"Employees",{"type":19,"tag":168,"props":2437,"children":2438},{"style":313},[2439],{"type":24,"value":101},{"type":19,"tag":168,"props":2441,"children":2442},{"style":175},[2443],{"type":24,"value":2444},"AnyAsync",{"type":19,"tag":168,"props":2446,"children":2447},{"style":313},[2448],{"type":24,"value":2449},"())\n",{"type":19,"tag":168,"props":2451,"children":2452},{"class":170,"line":455},[2453],{"type":19,"tag":168,"props":2454,"children":2455},{"style":313},[2456],{"type":24,"value":542},{"type":19,"tag":168,"props":2458,"children":2459},{"class":170,"line":465},[2460],{"type":19,"tag":168,"props":2461,"children":2462},{"style":864},[2463],{"type":24,"value":2464},"    // Setup initial test data\n",{"type":19,"tag":168,"props":2466,"children":2467},{"class":170,"line":536},[2468,2473,2477,2481,2486],{"type":19,"tag":168,"props":2469,"children":2470},{"style":313},[2471],{"type":24,"value":2472},"    db.",{"type":19,"tag":168,"props":2474,"children":2475},{"style":826},[2476],{"type":24,"value":2435},{"type":19,"tag":168,"props":2478,"children":2479},{"style":313},[2480],{"type":24,"value":101},{"type":19,"tag":168,"props":2482,"children":2483},{"style":175},[2484],{"type":24,"value":2485},"AddRange",{"type":19,"tag":168,"props":2487,"children":2488},{"style":313},[2489],{"type":24,"value":1530},{"type":19,"tag":168,"props":2491,"children":2492},{"class":170,"line":545},[2493,2498,2503,2508,2512,2516,2521,2525,2530,2534,2538,2543,2547,2552,2556,2561,2566,2570,2575],{"type":19,"tag":168,"props":2494,"children":2495},{"style":482},[2496],{"type":24,"value":2497},"        new",{"type":19,"tag":168,"props":2499,"children":2500},{"style":488},[2501],{"type":24,"value":2502}," Employee",{"type":19,"tag":168,"props":2504,"children":2505},{"style":313},[2506],{"type":24,"value":2507}," { Name ",{"type":19,"tag":168,"props":2509,"children":2510},{"style":414},[2511],{"type":24,"value":417},{"type":19,"tag":168,"props":2513,"children":2514},{"style":434},[2515],{"type":24,"value":682},{"type":19,"tag":168,"props":2517,"children":2518},{"style":440},[2519],{"type":24,"value":2520},"Tom",{"type":19,"tag":168,"props":2522,"children":2523},{"style":434},[2524],{"type":24,"value":437},{"type":19,"tag":168,"props":2526,"children":2527},{"style":313},[2528],{"type":24,"value":2529},", TaxPayerId ",{"type":19,"tag":168,"props":2531,"children":2532},{"style":414},[2533],{"type":24,"value":417},{"type":19,"tag":168,"props":2535,"children":2536},{"style":434},[2537],{"type":24,"value":682},{"type":19,"tag":168,"props":2539,"children":2540},{"style":440},[2541],{"type":24,"value":2542},"12345",{"type":19,"tag":168,"props":2544,"children":2545},{"style":434},[2546],{"type":24,"value":437},{"type":19,"tag":168,"props":2548,"children":2549},{"style":313},[2550],{"type":24,"value":2551},", Salary ",{"type":19,"tag":168,"props":2553,"children":2554},{"style":414},[2555],{"type":24,"value":417},{"type":19,"tag":168,"props":2557,"children":2558},{"style":349},[2559],{"type":24,"value":2560}," 50000",{"type":19,"tag":168,"props":2562,"children":2563},{"style":313},[2564],{"type":24,"value":2565},", Notes ",{"type":19,"tag":168,"props":2567,"children":2568},{"style":414},[2569],{"type":24,"value":417},{"type":19,"tag":168,"props":2571,"children":2572},{"style":434},[2573],{"type":24,"value":2574}," \"\"",{"type":19,"tag":168,"props":2576,"children":2577},{"style":313},[2578],{"type":24,"value":2579}," },\n",{"type":19,"tag":168,"props":2581,"children":2582},{"class":170,"line":618},[2583,2587,2591,2595,2599,2603,2608,2612,2616,2620,2624,2629,2633,2637,2641,2646,2650,2654,2658,2663,2667],{"type":19,"tag":168,"props":2584,"children":2585},{"style":482},[2586],{"type":24,"value":2497},{"type":19,"tag":168,"props":2588,"children":2589},{"style":488},[2590],{"type":24,"value":2502},{"type":19,"tag":168,"props":2592,"children":2593},{"style":313},[2594],{"type":24,"value":2507},{"type":19,"tag":168,"props":2596,"children":2597},{"style":414},[2598],{"type":24,"value":417},{"type":19,"tag":168,"props":2600,"children":2601},{"style":434},[2602],{"type":24,"value":682},{"type":19,"tag":168,"props":2604,"children":2605},{"style":440},[2606],{"type":24,"value":2607},"Dick",{"type":19,"tag":168,"props":2609,"children":2610},{"style":434},[2611],{"type":24,"value":437},{"type":19,"tag":168,"props":2613,"children":2614},{"style":313},[2615],{"type":24,"value":2529},{"type":19,"tag":168,"props":2617,"children":2618},{"style":414},[2619],{"type":24,"value":417},{"type":19,"tag":168,"props":2621,"children":2622},{"style":434},[2623],{"type":24,"value":682},{"type":19,"tag":168,"props":2625,"children":2626},{"style":440},[2627],{"type":24,"value":2628},"23456",{"type":19,"tag":168,"props":2630,"children":2631},{"style":434},[2632],{"type":24,"value":437},{"type":19,"tag":168,"props":2634,"children":2635},{"style":313},[2636],{"type":24,"value":2551},{"type":19,"tag":168,"props":2638,"children":2639},{"style":414},[2640],{"type":24,"value":417},{"type":19,"tag":168,"props":2642,"children":2643},{"style":349},[2644],{"type":24,"value":2645}," 100000",{"type":19,"tag":168,"props":2647,"children":2648},{"style":313},[2649],{"type":24,"value":2565},{"type":19,"tag":168,"props":2651,"children":2652},{"style":414},[2653],{"type":24,"value":417},{"type":19,"tag":168,"props":2655,"children":2656},{"style":434},[2657],{"type":24,"value":682},{"type":19,"tag":168,"props":2659,"children":2660},{"style":440},[2661],{"type":24,"value":2662},"Very busy",{"type":19,"tag":168,"props":2664,"children":2665},{"style":434},[2666],{"type":24,"value":437},{"type":19,"tag":168,"props":2668,"children":2669},{"style":313},[2670],{"type":24,"value":2579},{"type":19,"tag":168,"props":2672,"children":2673},{"class":170,"line":1092},[2674,2678,2682,2686,2690,2694,2699,2703,2707,2711,2715,2720,2724,2728,2732,2737,2741,2745,2749,2754,2758],{"type":19,"tag":168,"props":2675,"children":2676},{"style":482},[2677],{"type":24,"value":2497},{"type":19,"tag":168,"props":2679,"children":2680},{"style":488},[2681],{"type":24,"value":2502},{"type":19,"tag":168,"props":2683,"children":2684},{"style":313},[2685],{"type":24,"value":2507},{"type":19,"tag":168,"props":2687,"children":2688},{"style":414},[2689],{"type":24,"value":417},{"type":19,"tag":168,"props":2691,"children":2692},{"style":434},[2693],{"type":24,"value":682},{"type":19,"tag":168,"props":2695,"children":2696},{"style":440},[2697],{"type":24,"value":2698},"Sally",{"type":19,"tag":168,"props":2700,"children":2701},{"style":434},[2702],{"type":24,"value":437},{"type":19,"tag":168,"props":2704,"children":2705},{"style":313},[2706],{"type":24,"value":2529},{"type":19,"tag":168,"props":2708,"children":2709},{"style":414},[2710],{"type":24,"value":417},{"type":19,"tag":168,"props":2712,"children":2713},{"style":434},[2714],{"type":24,"value":682},{"type":19,"tag":168,"props":2716,"children":2717},{"style":440},[2718],{"type":24,"value":2719},"34567",{"type":19,"tag":168,"props":2721,"children":2722},{"style":434},[2723],{"type":24,"value":437},{"type":19,"tag":168,"props":2725,"children":2726},{"style":313},[2727],{"type":24,"value":2551},{"type":19,"tag":168,"props":2729,"children":2730},{"style":414},[2731],{"type":24,"value":417},{"type":19,"tag":168,"props":2733,"children":2734},{"style":349},[2735],{"type":24,"value":2736}," 199000",{"type":19,"tag":168,"props":2738,"children":2739},{"style":313},[2740],{"type":24,"value":2565},{"type":19,"tag":168,"props":2742,"children":2743},{"style":414},[2744],{"type":24,"value":417},{"type":19,"tag":168,"props":2746,"children":2747},{"style":434},[2748],{"type":24,"value":682},{"type":19,"tag":168,"props":2750,"children":2751},{"style":440},[2752],{"type":24,"value":2753},"Afternoons",{"type":19,"tag":168,"props":2755,"children":2756},{"style":434},[2757],{"type":24,"value":437},{"type":19,"tag":168,"props":2759,"children":2760},{"style":313},[2761],{"type":24,"value":2579},{"type":19,"tag":168,"props":2763,"children":2764},{"class":170,"line":1111},[2765,2769,2773,2777,2781,2785,2790,2794,2798,2802,2806,2811,2815,2819,2823,2828,2832,2836,2840,2845,2849],{"type":19,"tag":168,"props":2766,"children":2767},{"style":482},[2768],{"type":24,"value":2497},{"type":19,"tag":168,"props":2770,"children":2771},{"style":488},[2772],{"type":24,"value":2502},{"type":19,"tag":168,"props":2774,"children":2775},{"style":313},[2776],{"type":24,"value":2507},{"type":19,"tag":168,"props":2778,"children":2779},{"style":414},[2780],{"type":24,"value":417},{"type":19,"tag":168,"props":2782,"children":2783},{"style":434},[2784],{"type":24,"value":682},{"type":19,"tag":168,"props":2786,"children":2787},{"style":440},[2788],{"type":24,"value":2789},"Harry",{"type":19,"tag":168,"props":2791,"children":2792},{"style":434},[2793],{"type":24,"value":437},{"type":19,"tag":168,"props":2795,"children":2796},{"style":313},[2797],{"type":24,"value":2529},{"type":19,"tag":168,"props":2799,"children":2800},{"style":414},[2801],{"type":24,"value":417},{"type":19,"tag":168,"props":2803,"children":2804},{"style":434},[2805],{"type":24,"value":682},{"type":19,"tag":168,"props":2807,"children":2808},{"style":440},[2809],{"type":24,"value":2810},"45678",{"type":19,"tag":168,"props":2812,"children":2813},{"style":434},[2814],{"type":24,"value":437},{"type":19,"tag":168,"props":2816,"children":2817},{"style":313},[2818],{"type":24,"value":2551},{"type":19,"tag":168,"props":2820,"children":2821},{"style":414},[2822],{"type":24,"value":417},{"type":19,"tag":168,"props":2824,"children":2825},{"style":349},[2826],{"type":24,"value":2827}," 200000",{"type":19,"tag":168,"props":2829,"children":2830},{"style":313},[2831],{"type":24,"value":2565},{"type":19,"tag":168,"props":2833,"children":2834},{"style":414},[2835],{"type":24,"value":417},{"type":19,"tag":168,"props":2837,"children":2838},{"style":434},[2839],{"type":24,"value":682},{"type":19,"tag":168,"props":2841,"children":2842},{"style":440},[2843],{"type":24,"value":2844},"Weekends",{"type":19,"tag":168,"props":2846,"children":2847},{"style":434},[2848],{"type":24,"value":437},{"type":19,"tag":168,"props":2850,"children":2851},{"style":313},[2852],{"type":24,"value":2853}," });\n",{"type":19,"tag":168,"props":2855,"children":2856},{"class":170,"line":1129},[2857,2862,2866,2871],{"type":19,"tag":168,"props":2858,"children":2859},{"style":482},[2860],{"type":24,"value":2861},"    await",{"type":19,"tag":168,"props":2863,"children":2864},{"style":313},[2865],{"type":24,"value":2430},{"type":19,"tag":168,"props":2867,"children":2868},{"style":175},[2869],{"type":24,"value":2870},"SaveChangesAsync",{"type":19,"tag":168,"props":2872,"children":2873},{"style":313},[2874],{"type":24,"value":972},{"type":19,"tag":168,"props":2876,"children":2877},{"class":170,"line":1147},[2878],{"type":19,"tag":168,"props":2879,"children":2880},{"style":313},[2881],{"type":24,"value":1482},{"type":19,"tag":128,"props":2883,"children":2885},{"id":2884},"querying-encrypted-data",[2886],{"type":24,"value":2887},"Querying encrypted data",{"type":19,"tag":20,"props":2889,"children":2890},{},[2891],{"type":24,"value":2892},"Now we can query some data based on the encrypted fields!",{"type":19,"tag":157,"props":2894,"children":2896},{"className":301,"code":2895,"language":303,"meta":162,"style":162},"var found = db.Employees.First(e => e.TaxPayerId == \"12345\");\nConsole.WriteLine(found.Name);\n\nvar band2Earners = db.Employees.Where(e => e.Salary >= 100000m && e.Salary \u003C 200000m);\nforeach (var employee in band2Earners)\n    Console.WriteLine(employee.Name);\n",[2897],{"type":19,"tag":34,"props":2898,"children":2899},{"__ignoreMap":162},[2900,2974,2999,3006,3096,3127],{"type":19,"tag":168,"props":2901,"children":2902},{"class":170,"line":171},[2903,2907,2912,2916,2920,2924,2928,2933,2937,2941,2945,2949,2953,2958,2962,2966,2970],{"type":19,"tag":168,"props":2904,"children":2905},{"style":403},[2906],{"type":24,"value":406},{"type":19,"tag":168,"props":2908,"children":2909},{"style":313},[2910],{"type":24,"value":2911}," found ",{"type":19,"tag":168,"props":2913,"children":2914},{"style":414},[2915],{"type":24,"value":417},{"type":19,"tag":168,"props":2917,"children":2918},{"style":313},[2919],{"type":24,"value":2430},{"type":19,"tag":168,"props":2921,"children":2922},{"style":826},[2923],{"type":24,"value":2435},{"type":19,"tag":168,"props":2925,"children":2926},{"style":313},[2927],{"type":24,"value":101},{"type":19,"tag":168,"props":2929,"children":2930},{"style":175},[2931],{"type":24,"value":2932},"First",{"type":19,"tag":168,"props":2934,"children":2935},{"style":313},[2936],{"type":24,"value":346},{"type":19,"tag":168,"props":2938,"children":2939},{"style":1727},[2940],{"type":24,"value":2021},{"type":19,"tag":168,"props":2942,"children":2943},{"style":414},[2944],{"type":24,"value":1735},{"type":19,"tag":168,"props":2946,"children":2947},{"style":313},[2948],{"type":24,"value":2030},{"type":19,"tag":168,"props":2950,"children":2951},{"style":826},[2952],{"type":24,"value":2035},{"type":19,"tag":168,"props":2954,"children":2955},{"style":414},[2956],{"type":24,"value":2957}," ==",{"type":19,"tag":168,"props":2959,"children":2960},{"style":434},[2961],{"type":24,"value":682},{"type":19,"tag":168,"props":2963,"children":2964},{"style":440},[2965],{"type":24,"value":2542},{"type":19,"tag":168,"props":2967,"children":2968},{"style":434},[2969],{"type":24,"value":437},{"type":19,"tag":168,"props":2971,"children":2972},{"style":313},[2973],{"type":24,"value":452},{"type":19,"tag":168,"props":2975,"children":2976},{"class":170,"line":455},[2977,2981,2985,2990,2995],{"type":19,"tag":168,"props":2978,"children":2979},{"style":313},[2980],{"type":24,"value":316},{"type":19,"tag":168,"props":2982,"children":2983},{"style":175},[2984],{"type":24,"value":321},{"type":19,"tag":168,"props":2986,"children":2987},{"style":313},[2988],{"type":24,"value":2989},"(found.",{"type":19,"tag":168,"props":2991,"children":2992},{"style":826},[2993],{"type":24,"value":2994},"Name",{"type":19,"tag":168,"props":2996,"children":2997},{"style":313},[2998],{"type":24,"value":452},{"type":19,"tag":168,"props":3000,"children":3001},{"class":170,"line":465},[3002],{"type":19,"tag":168,"props":3003,"children":3004},{"emptyLinePlaceholder":459},[3005],{"type":24,"value":462},{"type":19,"tag":168,"props":3007,"children":3008},{"class":170,"line":536},[3009,3013,3018,3022,3026,3030,3034,3039,3043,3047,3051,3055,3059,3064,3069,3074,3078,3082,3087,3092],{"type":19,"tag":168,"props":3010,"children":3011},{"style":403},[3012],{"type":24,"value":406},{"type":19,"tag":168,"props":3014,"children":3015},{"style":313},[3016],{"type":24,"value":3017}," band2Earners ",{"type":19,"tag":168,"props":3019,"children":3020},{"style":414},[3021],{"type":24,"value":417},{"type":19,"tag":168,"props":3023,"children":3024},{"style":313},[3025],{"type":24,"value":2430},{"type":19,"tag":168,"props":3027,"children":3028},{"style":826},[3029],{"type":24,"value":2435},{"type":19,"tag":168,"props":3031,"children":3032},{"style":313},[3033],{"type":24,"value":101},{"type":19,"tag":168,"props":3035,"children":3036},{"style":175},[3037],{"type":24,"value":3038},"Where",{"type":19,"tag":168,"props":3040,"children":3041},{"style":313},[3042],{"type":24,"value":346},{"type":19,"tag":168,"props":3044,"children":3045},{"style":1727},[3046],{"type":24,"value":2021},{"type":19,"tag":168,"props":3048,"children":3049},{"style":414},[3050],{"type":24,"value":1735},{"type":19,"tag":168,"props":3052,"children":3053},{"style":313},[3054],{"type":24,"value":2030},{"type":19,"tag":168,"props":3056,"children":3057},{"style":826},[3058],{"type":24,"value":2131},{"type":19,"tag":168,"props":3060,"children":3061},{"style":414},[3062],{"type":24,"value":3063}," >=",{"type":19,"tag":168,"props":3065,"children":3066},{"style":349},[3067],{"type":24,"value":3068}," 100000m",{"type":19,"tag":168,"props":3070,"children":3071},{"style":414},[3072],{"type":24,"value":3073}," &&",{"type":19,"tag":168,"props":3075,"children":3076},{"style":313},[3077],{"type":24,"value":2030},{"type":19,"tag":168,"props":3079,"children":3080},{"style":826},[3081],{"type":24,"value":2131},{"type":19,"tag":168,"props":3083,"children":3084},{"style":414},[3085],{"type":24,"value":3086}," \u003C",{"type":19,"tag":168,"props":3088,"children":3089},{"style":349},[3090],{"type":24,"value":3091}," 200000m",{"type":19,"tag":168,"props":3093,"children":3094},{"style":313},[3095],{"type":24,"value":452},{"type":19,"tag":168,"props":3097,"children":3098},{"class":170,"line":545},[3099,3104,3108,3112,3117,3122],{"type":19,"tag":168,"props":3100,"children":3101},{"style":482},[3102],{"type":24,"value":3103},"foreach",{"type":19,"tag":168,"props":3105,"children":3106},{"style":313},[3107],{"type":24,"value":2415},{"type":19,"tag":168,"props":3109,"children":3110},{"style":403},[3111],{"type":24,"value":406},{"type":19,"tag":168,"props":3113,"children":3114},{"style":313},[3115],{"type":24,"value":3116}," employee ",{"type":19,"tag":168,"props":3118,"children":3119},{"style":482},[3120],{"type":24,"value":3121},"in",{"type":19,"tag":168,"props":3123,"children":3124},{"style":313},[3125],{"type":24,"value":3126}," band2Earners)\n",{"type":19,"tag":168,"props":3128,"children":3129},{"class":170,"line":618},[3130,3135,3139,3144,3148],{"type":19,"tag":168,"props":3131,"children":3132},{"style":313},[3133],{"type":24,"value":3134},"    Console.",{"type":19,"tag":168,"props":3136,"children":3137},{"style":175},[3138],{"type":24,"value":321},{"type":19,"tag":168,"props":3140,"children":3141},{"style":313},[3142],{"type":24,"value":3143},"(employee.",{"type":19,"tag":168,"props":3145,"children":3146},{"style":826},[3147],{"type":24,"value":2994},{"type":19,"tag":168,"props":3149,"children":3150},{"style":313},[3151],{"type":24,"value":452},{"type":19,"tag":20,"props":3153,"children":3154},{},[3155],{"type":24,"value":3156},"That's all there is to it, but if you want to dig a little deeper...",{"type":19,"tag":128,"props":3158,"children":3160},{"id":3159},"encryption-schemas",[3161],{"type":24,"value":3162},"Encryption schemas",{"type":19,"tag":20,"props":3164,"children":3165},{},[3166,3168,3174],{"type":24,"value":3167},"If you have some familiarity with other drivers or have read the docs you might be wondering where the Queryable Encryption field schema is. Well, our EF Core provider is generating that for you with all the necessary element names, BSON types, query specifications and attributes based on the fluent ",{"type":19,"tag":34,"props":3169,"children":3171},{"className":3170},[],[3172],{"type":24,"value":3173},".IsEncrypted",{"type":24,"value":3175}," methods you call against the EF ModelBuilder.",{"type":19,"tag":20,"props":3177,"children":3178},{},[3179],{"type":24,"value":3180},"This schema is, for now, client side only which allows you to rapidly iterate and change your mind about which fields are Queryable Encrypted and how.",{"type":19,"tag":253,"props":3182,"children":3183},{},[3184],{"type":19,"tag":20,"props":3185,"children":3186},{},[3187],{"type":24,"value":3188},"Before you go to production it is recommended that the schema be applied to the collection creation so that it can be enforced for all clients and no elements can be inadvertently left unencrypted by a misconfigured client. The trade-off is that in order to change any of the encryption parameters you would need to migrate the data to a new collection with the new encryption configuration which is beyond the scope of this quickstart.",{"type":19,"tag":20,"props":3190,"children":3191},{},[3192,3194,3200],{"type":24,"value":3193},"If you want to apply the generated schemas to the server yourself, you can use the ",{"type":19,"tag":34,"props":3195,"children":3197},{"className":3196},[],[3198],{"type":24,"value":3199},"QueryableEncryptionSchemaGenerator",{"type":24,"value":3201}," class that takes your EF Model and loop through each of the dictionary results to obtain the field schema necessary to provide to CreateCollection. We're looking at allowing this to be automated in a future EF Provider update.",{"type":19,"tag":103,"props":3203,"children":3205},{"id":3204},"limitations-considerations",[3206],{"type":24,"value":3207},"Limitations & considerations",{"type":19,"tag":20,"props":3209,"children":3210},{},[3211],{"type":24,"value":3212},"There are some important limitations and considerations to consider when encrypting data.",{"type":19,"tag":128,"props":3214,"children":3216},{"id":3215},"supported-data-types",[3217],{"type":24,"value":3218},"Supported data types",{"type":19,"tag":3220,"props":3221,"children":3222},"table",{},[3223,3251],{"type":19,"tag":3224,"props":3225,"children":3226},"thead",{},[3227],{"type":19,"tag":3228,"props":3229,"children":3230},"tr",{},[3231,3237,3242,3247],{"type":19,"tag":3232,"props":3233,"children":3234},"th",{},[3235],{"type":24,"value":3236},"CLR Type",{"type":19,"tag":3232,"props":3238,"children":3239},{},[3240],{"type":24,"value":3241},"BSON Type",{"type":19,"tag":3232,"props":3243,"children":3244},{},[3245],{"type":24,"value":3246},"Equality",{"type":19,"tag":3232,"props":3248,"children":3249},{},[3250],{"type":24,"value":1692},{"type":19,"tag":3252,"props":3253,"children":3254},"tbody",{},[3255,3281,3305,3329,3353,3378,3403,3427,3452,3477,3500,3521],{"type":19,"tag":3228,"props":3256,"children":3257},{},[3258,3267,3271,3276],{"type":19,"tag":3259,"props":3260,"children":3261},"td",{},[3262],{"type":19,"tag":34,"props":3263,"children":3265},{"className":3264},[],[3266],{"type":24,"value":501},{"type":19,"tag":3259,"props":3268,"children":3269},{},[3270],{"type":24,"value":501},{"type":19,"tag":3259,"props":3272,"children":3273},{},[3274],{"type":24,"value":3275},"✅ Yes",{"type":19,"tag":3259,"props":3277,"children":3278},{},[3279],{"type":24,"value":3280},"❌ No",{"type":19,"tag":3228,"props":3282,"children":3283},{},[3284,3293,3297,3301],{"type":19,"tag":3259,"props":3285,"children":3286},{},[3287],{"type":19,"tag":34,"props":3288,"children":3290},{"className":3289},[],[3291],{"type":24,"value":3292},"int",{"type":19,"tag":3259,"props":3294,"children":3295},{},[3296],{"type":24,"value":3292},{"type":19,"tag":3259,"props":3298,"children":3299},{},[3300],{"type":24,"value":3275},{"type":19,"tag":3259,"props":3302,"children":3303},{},[3304],{"type":24,"value":3275},{"type":19,"tag":3228,"props":3306,"children":3307},{},[3308,3317,3321,3325],{"type":19,"tag":3259,"props":3309,"children":3310},{},[3311],{"type":19,"tag":34,"props":3312,"children":3314},{"className":3313},[],[3315],{"type":24,"value":3316},"long",{"type":19,"tag":3259,"props":3318,"children":3319},{},[3320],{"type":24,"value":3316},{"type":19,"tag":3259,"props":3322,"children":3323},{},[3324],{"type":24,"value":3275},{"type":19,"tag":3259,"props":3326,"children":3327},{},[3328],{"type":24,"value":3275},{"type":19,"tag":3228,"props":3330,"children":3331},{},[3332,3341,3345,3349],{"type":19,"tag":3259,"props":3333,"children":3334},{},[3335],{"type":19,"tag":34,"props":3336,"children":3338},{"className":3337},[],[3339],{"type":24,"value":3340},"double",{"type":19,"tag":3259,"props":3342,"children":3343},{},[3344],{"type":24,"value":3340},{"type":19,"tag":3259,"props":3346,"children":3347},{},[3348],{"type":24,"value":3280},{"type":19,"tag":3259,"props":3350,"children":3351},{},[3352],{"type":24,"value":3275},{"type":19,"tag":3228,"props":3354,"children":3355},{},[3356,3365,3370,3374],{"type":19,"tag":3259,"props":3357,"children":3358},{},[3359],{"type":19,"tag":34,"props":3360,"children":3362},{"className":3361},[],[3363],{"type":24,"value":3364},"decimal",{"type":19,"tag":3259,"props":3366,"children":3367},{},[3368],{"type":24,"value":3369},"decimal128",{"type":19,"tag":3259,"props":3371,"children":3372},{},[3373],{"type":24,"value":3280},{"type":19,"tag":3259,"props":3375,"children":3376},{},[3377],{"type":24,"value":3275},{"type":19,"tag":3228,"props":3379,"children":3380},{},[3381,3390,3395,3399],{"type":19,"tag":3259,"props":3382,"children":3383},{},[3384],{"type":19,"tag":34,"props":3385,"children":3387},{"className":3386},[],[3388],{"type":24,"value":3389},"DateTime",{"type":19,"tag":3259,"props":3391,"children":3392},{},[3393],{"type":24,"value":3394},"date",{"type":19,"tag":3259,"props":3396,"children":3397},{},[3398],{"type":24,"value":3275},{"type":19,"tag":3259,"props":3400,"children":3401},{},[3402],{"type":24,"value":3275},{"type":19,"tag":3228,"props":3404,"children":3405},{},[3406,3415,3419,3423],{"type":19,"tag":3259,"props":3407,"children":3408},{},[3409],{"type":19,"tag":34,"props":3410,"children":3412},{"className":3411},[],[3413],{"type":24,"value":3414},"bool",{"type":19,"tag":3259,"props":3416,"children":3417},{},[3418],{"type":24,"value":3414},{"type":19,"tag":3259,"props":3420,"children":3421},{},[3422],{"type":24,"value":3275},{"type":19,"tag":3259,"props":3424,"children":3425},{},[3426],{"type":24,"value":3280},{"type":19,"tag":3228,"props":3428,"children":3429},{},[3430,3439,3444,3448],{"type":19,"tag":3259,"props":3431,"children":3432},{},[3433],{"type":19,"tag":34,"props":3434,"children":3436},{"className":3435},[],[3437],{"type":24,"value":3438},"ObjectId",{"type":19,"tag":3259,"props":3440,"children":3441},{},[3442],{"type":24,"value":3443},"objectId",{"type":19,"tag":3259,"props":3445,"children":3446},{},[3447],{"type":24,"value":3275},{"type":19,"tag":3259,"props":3449,"children":3450},{},[3451],{"type":24,"value":3280},{"type":19,"tag":3228,"props":3453,"children":3454},{},[3455,3464,3469,3473],{"type":19,"tag":3259,"props":3456,"children":3457},{},[3458],{"type":19,"tag":34,"props":3459,"children":3461},{"className":3460},[],[3462],{"type":24,"value":3463},"byte[]",{"type":19,"tag":3259,"props":3465,"children":3466},{},[3467],{"type":24,"value":3468},"binData",{"type":19,"tag":3259,"props":3470,"children":3471},{},[3472],{"type":24,"value":3275},{"type":19,"tag":3259,"props":3474,"children":3475},{},[3476],{"type":24,"value":3280},{"type":19,"tag":3228,"props":3478,"children":3479},{},[3480,3488,3492,3496],{"type":19,"tag":3259,"props":3481,"children":3482},{},[3483],{"type":19,"tag":34,"props":3484,"children":3486},{"className":3485},[],[3487],{"type":24,"value":1576},{"type":19,"tag":3259,"props":3489,"children":3490},{},[3491],{"type":24,"value":3468},{"type":19,"tag":3259,"props":3493,"children":3494},{},[3495],{"type":24,"value":3275},{"type":19,"tag":3259,"props":3497,"children":3498},{},[3499],{"type":24,"value":3280},{"type":19,"tag":3228,"props":3501,"children":3502},{},[3503,3508,3513,3517],{"type":19,"tag":3259,"props":3504,"children":3505},{},[3506],{"type":24,"value":3507},"Array & List",{"type":19,"tag":3259,"props":3509,"children":3510},{},[3511],{"type":24,"value":3512},"array",{"type":19,"tag":3259,"props":3514,"children":3515},{},[3516],{"type":24,"value":3280},{"type":19,"tag":3259,"props":3518,"children":3519},{},[3520],{"type":24,"value":3280},{"type":19,"tag":3228,"props":3522,"children":3523},{},[3524,3529,3533,3537],{"type":19,"tag":3259,"props":3525,"children":3526},{},[3527],{"type":24,"value":3528},"Class & Struct",{"type":19,"tag":3259,"props":3530,"children":3531},{},[3532],{"type":24,"value":528},{"type":19,"tag":3259,"props":3534,"children":3535},{},[3536],{"type":24,"value":3280},{"type":19,"tag":3259,"props":3538,"children":3539},{},[3540],{"type":24,"value":3280},{"type":19,"tag":128,"props":3542,"children":3544},{"id":3543},"general-limitations",[3545],{"type":24,"value":3546},"General limitations",{"type":19,"tag":20,"props":3548,"children":3549},{},[3550],{"type":24,"value":3551},"There are a few limitations to know about when using Queryable Encryption:",{"type":19,"tag":880,"props":3553,"children":3554},{},[3555,3560,3573,3578],{"type":19,"tag":884,"props":3556,"children":3557},{},[3558],{"type":24,"value":3559},"Encrypted elements can be either equality or range queries, but not both!",{"type":19,"tag":884,"props":3561,"children":3562},{},[3563,3565,3571],{"type":24,"value":3564},"Arrays or elements on an object within an array (e.g. on an ",{"type":19,"tag":34,"props":3566,"children":3568},{"className":3567},[],[3569],{"type":24,"value":3570},"OwnsMany",{"type":24,"value":3572},") cannot be encrypted",{"type":19,"tag":884,"props":3574,"children":3575},{},[3576],{"type":24,"value":3577},"Sorting on encrypted elements even if configured for range is not supported",{"type":19,"tag":884,"props":3579,"children":3580},{},[3581],{"type":24,"value":3582},"Nulls can not be stored or compared on encrypted elements",{"type":19,"tag":103,"props":3584,"children":3586},{"id":3585},"moving-to-production",[3587],{"type":24,"value":3588},"Moving to production",{"type":19,"tag":20,"props":3590,"children":3591},{},[3592],{"type":24,"value":3593},"While we've been able to get things up and running simply here there are a number of additional steps to take when considering how to move your application to production.",{"type":19,"tag":20,"props":3595,"children":3596},{},[3597],{"type":24,"value":3598},"Here's a short check-list to point you in the right direction but each step requires some planning and effort.",{"type":19,"tag":880,"props":3600,"children":3601},{},[3602,3607,3612,3617,3622,3627,3632],{"type":19,"tag":884,"props":3603,"children":3604},{},[3605],{"type":24,"value":3606},"Generate a new Customer Master Key",{"type":19,"tag":884,"props":3608,"children":3609},{},[3610],{"type":24,"value":3611},"Setup a secure key management system",{"type":19,"tag":884,"props":3613,"children":3614},{},[3615],{"type":24,"value":3616},"Generate your Data Encryption Keys",{"type":19,"tag":884,"props":3618,"children":3619},{},[3620],{"type":24,"value":3621},"Deploy the crypt_shared library with your package",{"type":19,"tag":884,"props":3623,"children":3624},{},[3625],{"type":24,"value":3626},"Adjust your application to use the new keys and service",{"type":19,"tag":884,"props":3628,"children":3629},{},[3630],{"type":24,"value":3631},"Include the Queryable Encryption Schema as you create each collection",{"type":19,"tag":884,"props":3633,"children":3634},{},[3635],{"type":24,"value":3636},"Have a plan and develop a tool for key rotation",{"type":19,"tag":103,"props":3638,"children":3640},{"id":3639},"thats-a-wrap",[3641],{"type":24,"value":3642},"That's a wrap",{"type":19,"tag":20,"props":3644,"children":3645},{},[3646],{"type":24,"value":3647},"I hope that you found this quickstart on Queryable Encryption with the MongoDB EF Core Provider helpful.",{"type":19,"tag":20,"props":3649,"children":3650},{},[3651,3653,3660],{"type":24,"value":3652},"You can find the ",{"type":19,"tag":56,"props":3654,"children":3657},{"href":3655,"rel":3656},"https://github.com/damieng/mongodb-efcore-examples",[60],[3658],{"type":24,"value":3659},"full source code to the sample",{"type":24,"value":3661}," over at GitHub.",{"type":19,"tag":20,"props":3663,"children":3664},{},[3665],{"type":24,"value":3666},"Enjoy!",{"type":19,"tag":20,"props":3668,"children":3669},{},[3670],{"type":24,"value":3671},"Damien",{"type":19,"tag":3673,"props":3674,"children":3675},"style",{},[3676],{"type":24,"value":3677},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":162,"searchDepth":455,"depth":455,"links":3679},[3680,3685,3691,3698,3702,3703],{"id":105,"depth":455,"text":108,"children":3681},[3682,3683,3684],{"id":130,"depth":465,"text":133},{"id":217,"depth":465,"text":220},{"id":237,"depth":465,"text":240},{"id":248,"depth":455,"text":251,"children":3686},[3687,3688,3689,3690],{"id":277,"depth":465,"text":280},{"id":360,"depth":465,"text":363},{"id":627,"depth":465,"text":630},{"id":745,"depth":465,"text":748},{"id":870,"depth":455,"text":873,"children":3692},[3693,3694,3695,3696,3697],{"id":930,"depth":465,"text":933},{"id":1258,"depth":465,"text":1261},{"id":2372,"depth":465,"text":2375},{"id":2884,"depth":465,"text":2887},{"id":3159,"depth":465,"text":3162},{"id":3204,"depth":455,"text":3207,"children":3699},[3700,3701],{"id":3215,"depth":465,"text":3218},{"id":3543,"depth":465,"text":3546},{"id":3585,"depth":455,"text":3588},{"id":3639,"depth":455,"text":3642},"markdown","content:blog:2025:mongodb-queryable-encryption.md","content","blog/2025/mongodb-queryable-encryption.md","blog/2025/mongodb-queryable-encryption","md","/blog/2025/mongodb-queryable-encryption/",2139,0,[3714,3718,3722],{"title":3715,"date":3716,"url":3717},"HTML5 Video Cheatsheet: Optimizing videos for the web","2025-12-05T00:00:00Z","/blog/2025/html5-video-cheatsheet/",{"title":3719,"date":3720,"url":3721},"Transactions in the MongoDB EF Core Provider","2025-10-25","/blog/2025/mongodb-explicit-transactions/",{"title":3723,"date":3724,"url":3725},"Lazy Loading with EF Core Proxies","2025-04-02","/blog/2025/ef-proxies/",[],1779224630029]