{"id":3180,"date":"2026-01-07T18:59:38","date_gmt":"2026-01-07T18:59:38","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2026\/01\/07\/secure-and-intelligent-queryable-encryption-and-vector-search-in-mongodb-ef-core-provider\/"},"modified":"2026-01-07T18:59:38","modified_gmt":"2026-01-07T18:59:38","slug":"secure-and-intelligent-queryable-encryption-and-vector-search-in-mongodb-ef-core-provider","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2026\/01\/07\/secure-and-intelligent-queryable-encryption-and-vector-search-in-mongodb-ef-core-provider\/","title":{"rendered":"Secure and Intelligent: Queryable Encryption and Vector Search in MongoDB EF Core Provider"},"content":{"rendered":"<blockquote>\n<p>This is a guest post by Rishit Bhatia and Luce Carter. Rishit is a Senior Product Manager at MongoDB focusing on the .NET Developer Experience and worked hands-on with C# for many years before moving into Product Management. Luce is a Senior Developer Advocate at MongoDB, Microsoft MVP, and lover of code, sunshine, and learning. This blog was reviewed by the Microsoft .NET team for EF Core.*<\/p>\n<\/blockquote>\n<p>The MongoDB Entity Framework (EF) Core provider has been generally available since May 2024. Since its launch, we\u2019ve been thrilled by the positive reception from the .NET developer community and its growing adoption across a wide range of applications.<\/p>\n<p>The provider empowers developers to integrate MongoDB seamlessly into their .NET projects using EF Core features like LINQ queries, change tracking, and optimistic concurrency, while harnessing MongoDB\u2019s flexibility and scalability.<\/p>\n<p>We\u2019ve continued to enhance the provider by <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/mongodb-ef-core-provider-whats-new\/\">adding new capabilities<\/a>, such as improved support for MongoDB-specific operations, performance optimizations, and expanded compatibility with the latest EF versions. These updates reflect our commitment to providing developers with a robust, intuitive, and reliable way to build modern applications with MongoDB and EF Core.<\/p>\n<p>We\u2019re excited to share two new major feature additions-namely, Queryable Encryption and Vector Search! These let you leverage some marquee MongoDB capabilities directly from the MongoDB EF Core provider through convenient APIs without having to rely on the underlying .NET C# driver.<\/p>\n<p>Let\u2019s take a sneak peek at what these look like.<\/p>\n<h2>MongoDB Queryable Encryption<\/h2>\n<p><a href=\"https:\/\/www.mongodb.com\/company\/blog\/product-release-announcements\/strengthen-data-security-mongodb-queryable-encryption\/?utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">Queryable Encryption<\/a> is a groundbreaking feature that allows you to encrypt sensitive data in your MongoDB database while still enabling you to query that data. This means you can maintain strong data privacy and compliance without sacrificing the ability to perform your queries.<\/p>\n<p>It\u2019s particularly important for industries with strict data governance requirements, like healthcare and finance.<\/p>\n<p>For users, this translates to enhanced security, reduced risk of data breaches, and simplified compliance efforts, as they can confidently encrypt data at rest and in transit without needing to re-architect their applications for querying encrypted fields.<\/p>\n<p>Configuring your data model to define encrypted properties in your <code>DbContext<\/code>\u2019s <code>OnModelCreating<\/code> is as simple as seen below:<\/p>\n<pre><code class=\"language-csharp\">protected override void OnModelCreating(ModelBuilder modelBuilder)\n{\n    modelBuilder.Entity&lt;Employee&gt;(entity =&gt;\n    {\n        entity.Property(e =&gt; e.TaxPayerId)\n            .IsEncryptedForEquality(&lt;Your Data Encryption Key GUID&gt;));\n\n        entity.Property(e =&gt; e.Salary)\n            .HasBsonRepresentation(BsonType.Decimal128)\n            \/\/ Salaries from 0 to 10 million, no decimal place precision\n            .IsEncryptedForRange(0m, 10000000m, 0,\n                &lt;Your Data Encryption Key GUID&gt;));              \n    });\n}<\/code><\/pre>\n<p>A small snippet of how querying works for equality and range queries is shown below:<\/p>\n<pre><code class=\"language-csharp\">\/\/Encrypted Equality Query\nvar specificEmployee = db.Employees.Where(e =&gt; e.TaxPayerId == \"45678\");\n\n\/\/Encrypted Range Query\nvar seniorEmployees = db.Employees.Where(e =&gt; e.Salary &gt;= 100000m &amp;&amp; e.Salary &lt; 200000m);<\/code><\/pre>\n<p>The <a href=\"https:\/\/dev.to\/mongodb\/getting-started-with-queryable-encryption-with-the-mongodb-ef-core-provider-5238\">full tutorial<\/a> shows you how you can encrypt your data and query it using the MongoDB EF Core provider.<\/p>\n<h2>MongoDB Vector Search<\/h2>\n<p><a href=\"https:\/\/www.mongodb.com\/products\/platform\/atlas-vector-search\/?utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">Vector search<\/a> revolutionizes how you can find and analyze unstructured data by enabling similarity searches based on semantic meaning rather than exact keywords. This capability is powered by vector embeddings, which represent data points (like text, images, or audio) as numerical vectors in a high-dimensional space.<\/p>\n<p>The importance of vector search lies in its ability to unlock new possibilities for AI-powered applications, such as recommendation engines, semantic search, and anomaly detection.<\/p>\n<p>For users, this means more intelligent and relevant search results, the ability to build sophisticated AI applications directly on their MongoDB data, and a richer understanding of their unstructured information.<\/p>\n<p>The following code block shows how you can easily set up your data model with vector embedding fields either in your <code>OnModelCreating<\/code> function or in your data model class itself:<\/p>\n<pre><code class=\"language-csharp\">\/\/Inside the OnModelCreating function \nb.Property(e =&gt; e.PlotEmbedding)\n   .HasElementName(\"plot_embedding_voyage_3_large\")\n   .HasBinaryVectorDataType(BinaryVectorDataType.Float32);\n\n\/\/ OR In the data model definition for the property\n[BinaryVector(BinaryVectorDataType.Float32)]\npublic float[] ? PlotEmbedding {get; set;}<\/code><\/pre>\n<p>Once you\u2019ve configured the above and have appropriate vector indexes to run vector search queries, running queries with your data is as easy as seen below:<\/p>\n<pre><code class=\"language-csharp\">\/\/Simple LINQ Vector Search query\nvar similarMovies = await db.Movies.VectorSearch(\n        e =&gt; e.PlotEmbedding,\n        myCustom.PlotEmbedding,\n        limit: 10)\n    .ToListAsync();<\/code><\/pre>\n<p>There are many more capabilities-such as running vector search queries with prefilters and projecting its scores available-in our <a href=\"https:\/\/dev.to\/mongodb\/mongodb-vector-search-with-ef-core-3dbh\">full tutorial<\/a>.<\/p>\n<h2>Get started today<\/h2>\n<p>The <a href=\"https:\/\/www.mongodb.com\/docs\/entity-framework\/current\/?utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">MongoDB EF Core provider<\/a> now allows you to use marquee MongoDB capabilities like Queryable Encryption and Vector Search directly from the provider.<\/p>\n<p>To get started, you can create a simple .NET console app that connects to <a href=\"https:\/\/www.mongodb.com\/products\/platform\/atlas-database\/?utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">MongoDB Atlas<\/a>, MongoDB\u2019s fully managed cloud database service. From there, you can explore these powerful capabilities in your application using the MongoDB EF Core provider. For step-by-step instructions, check out the <a href=\"https:\/\/www.mongodb.com\/docs\/entity-framework\/current\/quick-start\/?utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">quickstart guide<\/a>.<\/p>\n<h2>Learn more<\/h2>\n<p>To learn more about EF Core and MongoDB:<\/p>\n<ul>\n<li>See the <a href=\"https:\/\/learn.microsoft.com\/ef\/core\/\">EF Core documentation<\/a> to learn more about using EF Core to access all kinds of databases.  <\/li>\n<li>See the <a href=\"https:\/\/www.mongodb.com\/docs\/?utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">MongoDB documentation<\/a> to learn more about using MongoDB from any platform.  <\/li>\n<li>See the <a href=\"https:\/\/www.mongodb.com\/docs\/entity-framework\/current\/quick-start\/?utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">MongoDB EF Core provider documentation<\/a> for more information on how to get started.<\/li>\n<li>Check out the official documentation on <a href=\"https:\/\/www.mongodb.com\/docs\/manual\/core\/queryable-encryption\/?utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">Queryable Encryption<\/a> and <a href=\"https:\/\/www.mongodb.com\/docs\/atlas\/atlas-vector-search\/tutorials\/vector-search-quick-start\/?deployment-type=atlas&amp;interface=driver&amp;language=csharp&amp;utm_campaign=devrel&amp;utm_source=third-party-content&amp;utm_medium=cta&amp;utm_content=msdev-blog-ef-qe-and-vector-search&amp;utm_term=luce.carter\">Vector Search<\/a> to learn more about these topics.<\/li>\n<\/ul>\n<p>Go ahead and give it a go! Plus, if you want to level up your MongoDB skills and get a Credly-backed badge you can show off on LinkedIn, why not try the <a href=\"https:\/\/learn.mongodb.com\/courses\/vector-search-fundamentals?team=devrel-content\">Vector Search badge<\/a>.<\/p>\n<p>The post <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/mongodb-efcore-provider-queryable-encryption-vector-search\/\">Secure and Intelligent: Queryable Encryption and Vector Search in MongoDB EF Core Provider<\/a> appeared first on <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\">.NET Blog<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>This is a guest post by Rishit Bhatia and Luce Carter. Rishit is a Senior Product Manager at MongoDB focusing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":94,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-3180","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/3180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=3180"}],"version-history":[{"count":0,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/3180\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media\/94"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=3180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=3180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=3180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}