DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Data Engineering
  3. Databases
  4. What’s New for Developers in Azure Cosmos DB

What’s New for Developers in Azure Cosmos DB

Take a look at what Microsoft has introduced in their latest version of their database service.

Mohamed Radwan user avatar by
Mohamed Radwan
·
Jan. 31, 19 · News
Like (2)
Save
Tweet
Share
8.62K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction

For those of you that are new to the service, Cosmos DB is a global distributed multi-model database service, that allows you to read and write data from any Azure region with single-digit millisecond latency for both reads and writes,

Developer Update Highlights

.NET SDK Version 3.0 (Preview)

.NET SDK Version 3.0 targets .NET Standard 2.0, has a new intuitive object model designed to be easier to use, support for streams and performance improvements, and also it is open source on GitHub.

Database-level Throughput – 25x Lower Entry Point

This will enable you to make a new database, put as many containers as you want inside and have them all share the same throughput of the database.

Azure Pipelines Cosmos DB Emulator Build Tasks

Azure Pipelines Cosmos DB build task allows you to run tests against Cosmos DB emulator in your CI/CD pipelines.

A Real Example

Let’s see an example. Now I am going to create a new database with Cosmos DB in just one line (image 1). I will start with this ".database equals to this.cosmosClient" which is the entry point to interact with a Cosmos DB service. Off this Cosmos Client, we see that there is a new databases property off which we can access every method relevant to databases. In this case, I’ll use the CreateDatabaseIfNotExistsAsync method, giving the databaseId . I’ll put a wait in front of it, and now I’ve created a new database in just one line with Cosmos DB.

Image title

Image 1 – Create a new database in just one line with Cosmos DB


With the new SDK the object model is updated and also API surface is updated to be more modular. Now, as a result, we have a database object, a container object, and items, each with their own relevant methods. After we run the code, the resources in Cosmos DB (database container and item) will be actually created. If we check in the portal, navigate to data Explorer that is the one-stop shop for viewing all the data and the Cosmos DB containers. After refreshing, we can see that our “to do” database and “to do” container have both been created. If we open the “Documents” we can see that it is the same item which we created via console app (image 2).

Image title

Image 2 – Data explorer


If we take a closer look at our “to do” container, if we go to “Scale & Settings,” we can see more information about Scale and Conflict resolution (image 3).

Image title

Image 3 – Scale & Settings


Next, we will see a dev-test experience with an ASP.NET web application running again Cosmos DB. Actually, it is running against our local emulator. The emulator runs on Windows machines and allows you to emulate the Cosmos DB service locally, so you can do operations like creating databases and containers, running unit tests etc without incurring any cost on the Cosmos DB service. Now I will run my already created unit tests, which will create a new container, create a new database, add some items to it, test a query, running against a local version of the emulator.

Now also you can do the same thing in CI/CD pipeline. I have already a pipeline setup, which builds my web app, run some tests, and deploys it to azure app service. I just need to add my Cosmos DB emulator build task (image 4), which I can get it free from the Azure DevOps marketplace. There I should just specify that I want to use the endpoint emitted by the emulator container earlier in this pipeline.

Image title

Image 4 – Run Azure Cosmos DB Emulator container


After that, I can queue my build. On the image 5 you can see the log details.

Image title

Image 5 – Detailed logs of the Azure Cosmos Emulator DB container


This build task makes it a lot easier to use the Cosmos DB in CI/CD, meaning, you no longer need to deal with manually setting up a container and manually setting the emulator and getting it to run.

Conclusion

Azure Cosmos DB is Microsoft’s globally distributed multi-model database service. With the click of a button, Azure Cosmos DB enables you to elastically and independently scale throughput and storage across any number of Azure’s geographic regions. You can elastically scale throughput and storage, and take advantage of fast, single-digit-millisecond data access using your favorite API among SQL, MongoDB, Cassandra, Tables, or Gremlin. You can try Azure Cosmos DB for Free without an Azure subscription, free of charge and commitments. Try all the above mentioned and stay up-to-date on the latest Azure CosmosDB news and features.

Cosmos DB Cosmos (operating system) azure Database

Published at DZone with permission of Mohamed Radwan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Key Elements of Site Reliability Engineering (SRE)
  • Introduction to Automation Testing Strategies for Microservices
  • The 5 Books You Absolutely Must Read as an Engineering Manager
  • OWASP Kubernetes Top 10

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: