It’s Time to Switch from MongoDB to Microsoft Azure


Jingya Wang is a Microsoft Student Partner at Imperial College London, the following is a guest blog from Jingya on why to switch from MongoDB to Azure and its No SQL Services for your student projects.

twitter handle -

GitHub link -


You are deciding on which database you should use for your web app, searching for NoSQL database and coming cross MongoDB. ‘MongoDB has been #1 in the NoSQL category’! She is the one! Oh, wait a sec, what are the other options? Firebase, CouchDB, DocumentDB… If you are not only looking for a NoSQL database, but also prefer to manage your web app project in one place, Microsoft Azure can be the one!

Microsoft Azure is a cloud computing platform offering 66 products/services. To get started with Azure and its NoSQL services, jump to Get Started with Azure section. If you need to be convinced that Azure is the one, the following section 3 Reasons to Use Azure in Your Web App will tell you

1.       why you may favour Azure NoSQL services such as DocumentDB over MongoDB;

2.       why you should explore more products on Azure to get most out of it for your web app.

For those who are familiar with MongoDB, the section Switch from MongoDB to Azure NoSQL Services will show you that it is easy to pick up Azure NoSQL databases with your existing MongoDB knowledge. I will focus on a comparison of implementations between Azure DocumentDB and MongoDB, and show you how to think about data in DocumentDB. Hopefully by the end of this section, you will agree with me that DocumentDB is easy to learn, and worth learning.


3 Reasons to Use Azure in Your Web App


1.       Cloud Computing Means Anyone, Anywhere

One of the greatest advantages of using Azure, the cloud computing platform is, all team members can access it from anywhere. For example, DocumentDB is Paas (Platform-as-a-service) by design whereas MongoDB is not. Which means if all data for the web app is stored in DocumentDB, this environment is ideal for both testing, as all team members can work with the same database, rather than creating their own test cases and dummy data using MongoDB and run it in a localhost environment.

Although MongoDB launched its own hosted MongoDB as a service named MongoDB Atlas this year, one thing may put you off immediately - after signing up with your email, it asks immediately for payment. Whereas Azure offers you a 30-days free trial before charging for these services.

2.       Host Your Own Web App Easily

No matter you are writing this web app for your university degree, for your work, or even just for fun, you do not want this piece of code to get wasted. Sooner or later, you will start searching for host provider. Azure can be your long-term solution for web hosting.

2.1.             Protocol Support for MongoDB

When I was exploring all these products Azure offers, it makes me feel like you can always get something out of it. What if you already have an existing MongoDB app, and it is too late to start with DocumentDB? DocumentDB provides protocol support for MongoDB. For a step-by-step guide, follow the link here.

‘Using this preview functionality, customers can easily build and run applications in the Azure cloud - leveraging DocumentDB’s fully managed and scalable NoSQL databases - while continuing to use familiar skills and tools for MongoDB.’

2.2.             Azure App Service

If you hate to start from scratch and prefer your project in an organised manner, Azure App Service can create your web app in three steps. It not only provides you with a HTTPS URL to host your web app, but also provide you with a well-structured project directory with some basic code for you to get started with. The following steps give you with a general idea how to develop your first web app to Azure, and for more information, follow the link here.

Step 1: Select app type from

-          Web App,

-          Mobile App,

-          Function App,

-          Logic App,

-          API App;

Step 2: Select template from

-          ASP.NET Core 1.0,

-          ASP.NET with Azure Search Site,

-          Empty Site,

-          ExpressJs,

-          Java Coffee Shop,

-          MCV 5 With Entity Framework;

Step 3: Finally, your web app has been created and you can work with your app as seen below by

-          Edit your code online with Visual Studio,

-          Download web app content,

-          Download publishing profile,

-          Clone or push with git.  


Here I have selected 1. Web App => 2. ExpressJs. And the following image is the screenshot from ‘Edit your code online’ page. Everything is setup and it is time to start coding!


3.       There is Something More for Your Web App

For team development, get started for free with Visual Studio Team Services here. Along with DocumentDB and Azure App Service, these services should setup an efficient platform for your web app development.

For maintenance and further improvement, it is critical to analyse logs. you may be also interested in exploring Log Analytics (more information here), combined with Stream Analytics (more information here) for real-time data stream processing, and/or Machine Learning (more information here) for cloud predictive analytics.

Switch from MongoDB to Azure NoSQL Services

Microsoft Azure provides NoSQL services such as

·       Azure DocumentDB

·       Azure Table Storage

·       Azure HBase as a part of HDInsight

·       Azure Redis Cache

Among these NoSQL services, DocumentDB is the closest to MongoDB as both are document databases and store JSON(JavaScript Object Notation) or BSON (Binary JSON). If you are familiar with MongoDB, then it is easy to pick up DocumentDB. The following table provides a short summary on implementations between Azure DocumentDB and MongoDB using Node.js.







Environment Variables for Connection

·       Host endpoint

·       Database account master key of the endpoint

·       The database on our locally running instance of MongoDB

Data Models


·       Database to be created. Whereas in MongoDB it is an environment variable for connect.

·       Schema Free.

·       Flexible schema to be created.

·       Model - a class with which we construct documents. Similar to collection in DocumentDB.

CRUD (Create, Read, Update and Delete) and other operations

The link here provides a summary about sample solutions for CRUD as well as other operations and API references on database, collection, document.

Documentation here for CRUD operations on documents.


B-tree data structure

Automatically handle all aspects of indexing. For customised indexes, follow the link here.

Documentation here for handling indexes.


Due to the nature that both databases are document-oriented, some aspects such as CRUD operations are handled in a similar way. You may need to spend some time thinking about how to model your data in DocumentDB if you are used to MongoDB schema. The article ‘Modelling data in DocumentDB’ here may sharp your way of thinking data in DocumentDB.

There are posts providing a nice comparison between DocumentDB and MongoDB in terms of

-          Scaling – Sharding and Replication

-          Native REST interface

-          Data Interchange Format

-          Consistency

-          Monitoring

For further reading, I would highly recommend

David Green. ‘MongoDB vs. Azure DocumentDB’. April 2015.

where he provides a detailed comparison in terms of all aspects I mentioned above.

To learn more with other Azure NoSQL technologies, the document by David Chappell. ‘Understanding NoSQL on Microsoft Azure’. 2014. is a must.

Download PDF

Get Started with Azure

1.       Create your Azure account

Step 1: To create your Azure account, follow the link here. Click Start for free for 30 days free trial.


Step 2: It will lead you to the sign up page as seen below. Notice here it will ask you for Identity Verification by Phone and Identity Verification by Card. Your credit card will not be charged for this offer unless you explicitly remove the spending limit. For more information regarding the free account, see FAQ here.


Note: If you are an university student, you can follow the link here to Create a Microsoft Image profile first. After getting verified as a student, follow the link here to Get Microsoft Image with Azure. This benefit should provide you access to the following services (more information here):

-          Azure App Services

-          SQL Database

-          MySQL Database from ClearDB

-          Visual Studio Application Insights

-          Visual Studio Team Services

But please be aware that you will probably run into the issue as seen below in most cases. Bad! So I would recommend providing your credit card information in exchange of services with full features.


2.       Azure Portal

Follow the link here to sign in to Azure Portal and start your Azure journey. Azure Portal is the console where you can manage all your Azure products/services. Following is the dashboard displayed when you sign in to the portal.


3.       Create Azure DocumentDB NoSQL Account and Document Explorer

Follow the link here to create your Azure DocumentDB NoSQL account. Then still in Azure portal, you can launch Document Explorer by following the link here to view JSON objects created using DocumentDB.

4.       Create Azure Storage Account and Microsoft Azure Storage Explorer

Follow the link here to create your Azure storage account to get started with Table storage. This account also allows you to work with other storages such as Blob storage. Later you will need Account Name and Access Keys to create connections in your Web App server and view data in Microsoft Azure Storage Explorer.

To view all data in for example, Table Storage, download Microsoft Azure Storage Explorer here. After opening the explorer, to connect to Azure Storage, follow the steps below. This step-by-step guide applies to other Azure Storage services such as Blob Storage.

Step 1:


Step 2: Enter Access Key obtained after creating the Storage account on Azure portal, then click Next.

Step 3: Select Use an account name and key to connect to an Azure Storage account and click Next.

Step 4: Enter the storage account name and click Connect.

Step 5: You should be able to find your storage account under Storage Accounts.


To summarise with, Microsoft Azure is perfect to manage your web app project in one place. It provides lots of services such as App Service, Visual Studio Team Services, DocumentDB, Stream Analytics and so on, and each helps with your web app at different stages – setup, development, testing, maintenance and further improvement respectively.

MongoDB is great as a NoSQL database with its strong consistency, flexibility, scalability and performance, but for an organised web app project, Microsoft Azure can be a better solution. Pricing may be the biggest turnoff, but you get 30 days to make up your mind. In the meantime,


Comments (18)
  1. This title makes no sense given MongoDB is a database and Azure is a cloud based platform

  2. You make an argument for DocumentDB being a PaaS being a good thing. I would argue that for a student this is a REALLY bad thing. MongoDB has a community version any student can download for free and run on their laptop in minutes. Then move to the cloud when they actually have money to spend. And MongoDB Atlas isn’t the only way to run MongoDB in the cloud, there are literally many many options.

    Starting for free is very short sighted as well. Azure is NOT free, it will cost you money after 30 days. You can run the Community Version of MongoDB as long as you want for free.

    Which brings me to the biggest reason any student shouldn’t even consider DocumentDB. And that is that MongoDB is one of the fastest growing job markets. If you want to learn something that is good for your future, learn MongoDB.

    Joshua Austill

  3. Niraj says:

    This writing was expected from one and only Microsoft. Cause if you don’t know what to create great you can copy from others and claim it is great. The only thing is great about a close environment is great support. The vibrant community in MongoDB and all other open source projects is far more than any writing. If you want to be a developer or want to develop something great then only way is open source. Yes it is correct you need to find a lot of things. But to do something new, something amazing you always need to find a lot of things. And top of everything money is not mandatory to create something great. To become a developer in Microsoft community you need invest which is very sad :(.

    1. Lee Stott says:

      Hi couldn’t agree more about OpenSource and more importantly students contributing to open source to show a real life portfolio speaking of Microsoft and OpenSource we are the largest contributors to GitHub. Here is a rundown of companies and the amount of code they publicly contributed to Github:
      1- Microsoft — 16,419
      2- Facebook — 15,682
      3-Docker — 14,059
      4-Angular — 12,841
      5-Google — 12,140
      6-Atom — 9,698
      7-FortAwesome — 9,617
      8-Elastic — 7,220
      9-Apache — 6,999
      10-Npm — 6,815


      We also have a number of dedicated repos and for students and are all regular opensource community contributors.

  4. Julia Goolia says:


  5. H.P. Grahsl says:

    Your Reason 1:

    As you correctly pointed out there is MongoDB Atlas which is one of the best DBaaS services I’ve seen so far to run, monitor, automate and backup your MongoDB deployments. See a presentation from MongoDB Europe 16 in London last week (=>

    While you are right with the credit card information that’s needed during setup (at least up to now – this might change?):
    a) like with Azure there are PROMO Codes to use the Atlas service free of charge
    b) I’m not totally sure for DocumentDB but there are other services in Azure which need credit card information as well even during your free trial phase, but like with Atlas they then don’t charge your card
    c) besides Atlas there are other fully managed services which don’t charge you at all for very small instances (which should be sufficient for student projects) – maybe we’ll see this soon for Atlas as well. This is not even available for DocumentDB since currently there’s no free tier that I’m aware of.

    Your Reason 2:

    2.1 => … or the other way around. So, for instance, in case you want to employ your SQL skills there are options and tools to run standard SQL against your MongoDB database or make use of your favorite connect BI tools.

    2.2 => Has nothing to do with DocumentDB. In case you like Azure for writing cloud services (like I do very much myself!) you can enjoy all of Azure and still use MongoDB at the same time without any issues whatsoever.

    Your Reason 3:

    Again like with 2.2 – no problem at all to connect a variety of Azure Services with MongoDB using your favorite languages. There are connectors for Stream Computation or ML with Storm/Spark and now even Kafka on HDInsight etc.

    Besides the above, let me bring a few more aspects to the party which aren’t directly related to your arguments:

    1) MongoDB is THE leading NoSQL DocumentDB
    2) MongoDB has a longer history and has matured over the years
    3) MongoDB is extremely feature rich compared to DocumentDB. When you take a look at the “feature wishlist” for DocumentDB you’ll see that most of the “top 20” on the first page are available in MongoDB out of the box (some of them for a long time already)
    4) MongoDB can be used locally (which isn’t a disadvantage – on the contrary!) while Azure DocumentDB only recently came up with a first version of a Local Emulator
    5) MongoDB offers high flexibility (encryption, auth mechanisms, special purpose storage engines etc.)

    So at the end of the day, it’s totally up to you to accept these facts or silently ignore the reality. And please, don’t get me wrong here! DocumentDB is a great Service but so is MongoDB Atlas. I think it highly depends on particular needs. In general, you cannot simply recommend either of the two to anyone without a deeper evaluation of the corresponding use cases. Both have their strengths & weaknesses where they can and will improve…


    1. Lee Stott says:

      Hi I agree with your comments and great to see so much debate over this, the key thing with the Azure Marketplace there has never been a easier time to assess and compare services and technologies as you state its a horses for course debate neither is worse or better it simply depends on what you want to do. So if you wanted to spin upa managed MonogoDB instance there is a solution and we also provide guidance at

  6. Bill Finch says:

    Hi Jingya! First of all let me say that your article is well-researched and well delivered from the perspective of DocumentDB. I would just like to give a few thoughts about MongoDB that set it apart from DocumentDB at this point in time.

    1. Maturity – MongoDB is a much more mature product in support for driver stacks. For example MongoDB offers officially supported drivers for legacy languages such as C/C++, Perl, & PHP, as well as newer ones such as Ruby and Scala. MongoDB also offers native data types not provided by DocumentDB such as DateTime and Geospatial types. The need to work around these limitations adds time and complexity to even simple date and location based functionality.

    2. PaaS vs. DBaaS – As you have stated, DocumentDB is native to Azure and is not accessible via a localhost installation. This is both a blessing and a curse in my opinion. On the plus side it is “always on” and accessible. On the minus side that means that you must also be “always on”. That is not such a big deal for most people, but there is something to be said for not having to depend on internet access to get your work done. 🙂 MongoDBs new DBaaS platform, Atlas, give the same always on flexibility, but you always have the ability to take a backup of your data and restore it locally for offline work and/or specific use-case testing without impacting your main environment. There is a rich ecosystem of virtual machine environments (VirtualBox, VMWareFusion, etc.) that allow you to create simple to highly complex testing environments with MongoDB that mimic real-world scenarios.

    3. Development/Administration Features – Admittedly, the rich availability of paid and open-source MongoDB tools and UI applications is a function of the relative maturity of the product. That said, there is a wealth of resources for the MongoDB developer and administrator to call on. Monitoring and metrics are also much more well fleshed out. Currently your DocumentDB monitoring is limited to basically total requests and requests/second. This may well be sufficient for a Minimally Viable Product at soft launch, but for ongoing growth and performance monitoring you will definitely need more.

    4. Programming: One of the greatest strengths of MongoDB, in my opinion, is the Aggregation Framework. It gives you a wealth of aggregate and Map-Reduce functionality that DocumentDB does not provide. For that level of complexity in DocumentDB you must write SQL function and stored procedure-like objects, but with Javascript as the working language. This adds another level of development complexity to your solution.

    5. Career Path – MongoDB is widely adopted by many diverse industries. From web and media content providers to insurance to travel and many others, adoption of MongoDB is robust and growing rapidly. There is a growing demand for MongoDB developers and DBAs across the board, with many training opportunities available to further your skills and career prospects.

    Thanks for an informative look at DocumentDB and it’s current capabilities. I have no doubt that as time passes many of the features lacking in comparison to MongoDB will come online with maturity. For now though I think it may be premature to say that DocumentDB is a fully-realized replacement for MongoDB. It may be that they will always occupy distinct niches in the NoSQL world…

  7. Ralph Greschner says:

    Jingya, thank you for your blog post.

    While I consider it pretty interesting what Microsoft is doing with DocumentDB at the moment I don’t think the time is quite right for a total switch from MongoDB yet.
    Of course, having alternatives and new options to established solutions is always nice, but as far as I see it DocumentDB seems to be at the beginning compared to MongoDB.

    First off, the MongoDB wire protocol support in it is pretty new, whereas MongoDB is in production use for a long time now by many big companies.

    Secondly, I suppose MongoDB has a larger community following. The community as such is very open and might also give help in troubleshooting. There also is MongoDB University for acquiring new knowledge.

    Also, there are companies which provide MongoDB as PaaS solution, like MongoDB themselves with Atlas or mLab. There even is a free plan with mLab. Did you consider those before looking at Azure?

    Kind Regards,


  8. Hello,

    some month ago I had to make a decision for a very large project. I had to make a decision which database to use for a big web app in the electronics business. We did an in depth analysis and POCs. We came to the conclusion to go for MongoDB. I like to share these since I like to get an objective picture on what we found as good reasons for this decision. I like to use Azure so there is not left or right, good or better – just plain fact which you please use on your own.
    Since the build web app is an Enterprise Application dealing with business critical data we need a mature, enterprise ready database which is one of the strengths of MongoDB. High availibilty 365/24/7, very flexible scalability and easy administration of clusters where indicators of the maturity. These kind of big applications might have been traditionally an area for Oracle / Java where you find many procedures and best practices – so I had some concerns if we can get all developers on a consistent, well formed development path, and if we get the application it self build up on soild ground (easy to extend even after some versions, clean structured and mainable). Beside the normal craft of architecture we double checked parts of our decisions with the MongoDB community. I am an opensoucre minded person, but I really under evaluated the support and this community. We took at the beginning into consideration that the MongoDB is much larger than the DocumentDB community and that questions might be better asked to a wider audience. We did not expect so much help from very experienced folks, they are part of our projects success.
    In conclusion, I do not want to judge – the decision pro MongoDB payed of for us building a large enterprise application.

  9. Lina Lora says:

    I think it’s worth mentioning another MongoDB advantage over DocumentDB, as mentioned in the article MongoDB provides strong consistency, flexibility, scalability and performance, but also MongoDB has a larger supportive community, making it easier to find documentation, and resources such as blog posts and Stackoverflow answers that are very useful for solving problems and clarifying doubts.

  10. Satoshi Okano says:

    Thank you for a good article. I usually use MongoDB, but I was able to learn about DocumentDB by reading this.
    Certainly DocumentDB is a great product. Multi-document transaction is fascinating for MongoDB users.

    However, I think it is better to think about the following points.

    – DocumentDB does not include aggregation capability. So It can be a problem when trying to migrate existing applications.

    – Developer mind share: MongoDB is widely popular among application developers. For example, in the db-engines ranking, mongodb is fifth, but DocumentDB remains at 60th. (As of November 2016)

  11. Lee Stott says:

    Hi All, great to see so much debate on this blog, just to stress MongoDB is fully supported on Microsoft Azure so the choice of platform is yours as a developer. MongoDB on Azure brings the power of the leading next-generation database to Microsoft’s flexible, open, and scalable cloud. I have to stress Microsoft Azure is an open and flexible cloud platform that enables you to quickly build, deploy, and manage applications across a global network of Microsoft-managed datacenters. You can build applications using any language, tool, or framework. You can also integrate your public cloud applications with your existing IT environment.
    Together, MongoDB and Azure provide customers the tools to build limitlessly scalable applications in the cloud.
    Users interested in deploying MongoDB directly on Azure can do so using Azure VM (Azure Infrastructure-as-a-Service) on Linux or Windows, or Azure Worker Roles (Azure Platform-as-a-Service) on Windows. see and

  12. Andrew Liu says:

    DocumentDB team member here. Really love the blog, and appreciate all the great feedback here.

    We’ve recently released a DocumentDB Emulator to help ease the cost of development (it’s free!) and allows you to develop locally (for those who like to develop in areas with spotty internet). Check it out here:

    It is also interesting to note that one of the most challenging areas for running non-PAAS databases is manageability. Maintaining replica sets for high availability and managing partitions to scale-out for a production application is an extremely difficult endeavor – especially if you do not have a dedicated full-time database staff (you will find that you will quickly become this staff if you don’t have one… preventing you from doing what you love best – building your application). Every time your database has a critical update or an issue – you have a fire drill.

    DocumentDB comes with a 99.99% availability SLA, along with strong guarantees on throughput, consistency, and performance. In the event of any issue, we have a 24/7 on-call staff comprised of our world-class engineering team to keep your application up and running smoothly. Furthermore, partition management is completely taken care of server-side… allowing developers to easily scale up and scale down elastically and effortlessly at the push of a button.

    For example, scaling from 100 VMs => up to 200 VMs => back down to 100 VMs => back up to 150 VMs to help balance scale and cost is non-trivial for non-PAAS VMs. You’ll want to do this infrequently, and maintaining availability/uptime during this period is even more difficult.

    DocumentDB gives you the ability to scale up, down, and back-and-forth anytime you want effortlessly while maintaining availability… so if you want to scale up during peak traffic hours and back down every single day – you are free to do so 🙂

    I’ll also call out that both me and my team are hardcore database geeks and are super passionate in this area. If you ever have any questions or want to chat – feel free to ping us anytime at: askdocdb at microsoft dot com.

  13. I can not believe Microsoft leaves us without the ability to build MongoDB based apps.
    If I am right, it wants us to use his cloud as a database instead.
    It is not woth it.
    Not fair play guys…

    1. Lee Stott says:


      MonogDb is fully available on Azure see and there are images available in the Azure Marketplace for VM deployment see and details on creating sharded clusters see

  14. Robert Walters says:

    MongoDB Atlas is now available on Azure as a database as a service offering supported and maintained by MongoDB.

Comments are closed.

Skip to main content