{"id":9038,"date":"2024-11-19T05:30:54","date_gmt":"2024-11-19T13:30:54","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=9038"},"modified":"2025-02-17T07:18:21","modified_gmt":"2025-02-17T15:18:21","slug":"data-api-public-preview-in-vcore-based-azure-cosmos-db-for-mongodb","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/data-api-public-preview-in-vcore-based-azure-cosmos-db-for-mongodb\/","title":{"rendered":"Data API Public Preview in vCore-based Azure Cosmos DB for MongoDB"},"content":{"rendered":"<p><span data-contrast=\"none\">We&#8217;re excited to announce that the Data API for vCore-based Azure Cosmos DB for MongoDB is now in public preview. This Data API offers a flexible and powerful way for you to interact with your database using HTTP-based API calls.<\/span><\/p>\n<p><span data-contrast=\"none\">The Data API for <\/span><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/\"><span data-contrast=\"none\">vCore-based Azure Cosmos DB for MongoDB<\/span><\/a><span data-contrast=\"none\"> lets you work with your MongoDB vCore data through straightforward HTTP requests, removing the need for traditional drivers or complex queries. You can easily perform basic operations like creating, reading, updating, and deleting data directly from your applications. This approach simplifies connecting your MongoDB data to web apps, mobile apps, or tools like Power BI, all through a familiar and user-friendly API. With this API, you can interact with MongoDB data directly from applications, including web, mobile, or serverless environments, without needing a MongoDB driver or managing a backend server.<\/span><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/data-api.png\"><img decoding=\"async\" class=\"size-full wp-image-9039 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/data-api.png\" alt=\"Image data api\" width=\"613\" height=\"261\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/data-api.png 613w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/data-api-300x128.png 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<p><span data-contrast=\"auto\">Here are some of the key reasons and benefits for using the MongoDB Data API:<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">How it helps<\/span><\/b><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">The Data API simplifies interactions with Azure Cosmos DB for MongoDB by providing a direct HTTP-based method to access data. It provides benefits such as,<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Ease of Integration with Frontend Apps<\/span><\/b><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The MongoDB vCore Data API enables direct interaction with MongoDB vCore data over HTTP, reducing backend requirements and simplifying frontend integration for web and mobile apps.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Reduced Backend overhead<\/span><\/b><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The Data API enables direct access to MongoDB vCore, eliminating the need for a custom backend and reducing infrastructure and maintenance costs. By abstracting database connectivity, it lets developers focus on core app features rather than managing connections and error handling. This approach simplifies code and speeds up development for streamlined applications.<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Support for Multiple Data Types and Aggregation<\/span><\/b><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The API supports MongoDB BSON data types, including dates and embedded documents, enabling structured data handling. It integrates with MongoDB&#8217;s aggregation framework, which facilitates advanced operations like filtering, grouping, and transforming data. This makes the API ideal for applications with complex data requirements. When to Use the MongoDB Data API vs. a Traditional Driver<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">In general, the MongoDB vCore Data API is ideal when:<\/span><span data-ccp-props=\"{&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">You are working in an environment where a direct MongoDB driver is impractical (e.g., mobile, frontend).<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">You want to avoid backend complexity, especially for simpler applications.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">Conversely, if you need higher performance, lower latency, or specialized database functions not available in the Data API, a traditional MongoDB driver may be better suited.<\/span><span data-ccp-props=\"{&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">Getting Started:<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:160,&quot;335559739&quot;:80}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">Here is an example of how to use Data API:<\/span><span data-ccp-props=\"{&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<p aria-level=\"3\"><b><span data-contrast=\"auto\">Example<\/span><\/b><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:160,&quot;335559739&quot;:80}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">To read active products from a products collection:<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code>curl {cluster-name}.data.global.mongocluster.cosmos.azure.com:443\/data\/v1\/action\/aggregate -H <span class=\"hljs-string\">\"Content-Type: application\/ejson\"<\/span> -H <span class=\"hljs-string\">\"Accept:application\/ejson\"<\/span> -d <span class=\"hljs-string\">'{\"database\": \"newDB\", \"collection\": \"products\", \"pipeline\": [{\"$limit\": 500}]}'<\/span><\/code><\/pre>\n<p><span data-contrast=\"none\">This retrieves all documents from the products collection where status is active, using a straightforward HTTP request.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"none\">If you\u2019re excited about what this feature can do for you, try it out today! !<\/span><span data-contrast=\"none\">\u00a0<\/span><span data-contrast=\"none\">Check out\u00a0 <\/span><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/data-api\"><span data-contrast=\"none\">documentation<\/span><\/a><span data-contrast=\"none\">\u00a0 to get started.<\/span><span data-ccp-props=\"{&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">Conclusion<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:160,&quot;335559739&quot;:80}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">The MongoDB vCore Data API provides a versatile, secure, and simple method for accessing MongoDB databases over HTTP, supporting a range of applications, from web and mobile . By simplifying the connection to MongoDB vCore, it speeds up development and reduces backend complexity<\/span><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;335559738&quot;:240,&quot;335559739&quot;:240}\">\u00a0<\/span><\/p>\n<h4 aria-level=\"2\"><span data-contrast=\"none\">Leave a review<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:160,&quot;335559739&quot;:80}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we\u2019ll gift<\/span><span data-contrast=\"auto\">)<\/span><span data-contrast=\"auto\"> you $50.\u202f<\/span><a href=\"https:\/\/peerspotdotcom.my.site.com\/proReviews\/?SalesOpportunityProduct=00kPy000004TKXJIA4&amp;productPeerspotNumber=30881&amp;CalendlyAccount=peerspot&amp;CalendlyFormLink=peerspot-product-reviews-ps-gc-vi-sf-50&amp;giftCard=50%22%20\\t%20%22_blank\"><span data-contrast=\"none\">Get started here<\/span><\/a><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h4 aria-level=\"2\"><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:160,&quot;335559739&quot;:80}\">\u00a0<\/span><span data-contrast=\"none\">About Azure Cosmos DB<\/span><span data-ccp-props=\"{&quot;134245418&quot;:true,&quot;134245529&quot;:true,&quot;335559738&quot;:160,&quot;335559739&quot;:80}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"none\">Azure Cosmos DB is a fully managed and serverless distributed database for modern app development, with SLA-backed speed and availability, automatic and instant scalability, and support for open-source PostgreSQL, MongoDB, and Apache Cassandra. Try Azure Cosmos DB for free <\/span><a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/cosmos-db\/\"><span data-contrast=\"none\">here<\/span><\/a><span data-contrast=\"none\">. To stay in the loop on Azure Cosmos DB updates, follow us on <\/span><a href=\"https:\/\/twitter.com\/azurecosmosdb\"><span data-contrast=\"none\">X<\/span><\/a><span data-contrast=\"none\">, <\/span><a href=\"https:\/\/www.youtube.com\/channel\/UCxZVmw8Rt_xmTpPIzLRMDkw\"><span data-contrast=\"none\">YouTube<\/span><\/a><span data-contrast=\"none\">, and <\/span><a href=\"https:\/\/www.linkedin.com\/showcase\/azure-cosmos-db\"><span data-contrast=\"none\">LinkedIn<\/span><\/a><span data-contrast=\"none\">.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;re excited to announce that the Data API for vCore-based Azure Cosmos DB for MongoDB is now in public preview. This Data API offers a flexible and powerful way for you to interact with your database using HTTP-based API calls. The Data API for vCore-based Azure Cosmos DB for MongoDB lets you work with your [&hellip;]<\/p>\n","protected":false},"author":80443,"featured_media":9040,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12,15],"tags":[],"class_list":["post-9038","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcements","category-mongodb-api"],"acf":[],"blog_post_summary":"<p>We&#8217;re excited to announce that the Data API for vCore-based Azure Cosmos DB for MongoDB is now in public preview. This Data API offers a flexible and powerful way for you to interact with your database using HTTP-based API calls. The Data API for vCore-based Azure Cosmos DB for MongoDB lets you work with your [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/9038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/80443"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=9038"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/9038\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/9040"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=9038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=9038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=9038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}