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 - https://twitter.com/JWT0T
GitHub link - https://github.com/JWT0T
Introduction
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.
|
|
|
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.
| | |
| | |
|
|
|
| ![]() | |
|
| |
|
|
|
|
| |
|
|
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.
https://www.simple-talk.com/cloud/cloud-data/mongodb-vs-azure-documentdb/
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 https://go.microsoft.com/fwlink/p/?LinkId=330292
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.
Conclusion
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
- Anonymous
November 20, 2016
This title makes no sense given MongoDB is a database and Azure is a cloud based platform - Anonymous
November 21, 2016
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 - Anonymous
November 21, 2016
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 :(.- Anonymous
November 23, 2016
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,4192- Facebook — 15,6823-Docker — 14,0594-Angular — 12,8415-Google — 12,1406-Atom — 9,6987-FortAwesome — 9,6178-Elastic — 7,2209-Apache — 6,99910-Npm — 6,815see https://octoverse.github.com/We also have a number of dedicated repos https://github.com/microsoft/ and for students http://github.com/msftimagine and are all regular opensource community contributors.
- Anonymous
- Anonymous
November 21, 2016
Interesting - Anonymous
November 21, 2016
The comment has been removed- Anonymous
November 23, 2016
Hi I agree with your comments and great to see so much debate over this, the key thing with the Azure Marketplace https://azure.microsoft.com/en-us/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 https://azure.microsoft.com/en-gb/marketplace/partners/bitnami/mongodb/ and we also provide guidance at https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-classic-install-mongodb
- Anonymous
- Anonymous
November 21, 2016
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... - Anonymous
November 21, 2016
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, Ralph - Anonymous
November 21, 2016
The comment has been removed - Anonymous
November 21, 2016
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. - Anonymous
November 21, 2016
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)http://db-engines.com/en/ranking - Anonymous
November 22, 2016
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 https://docs.mongodb.com/ecosystem/platforms/windows-azure/ and https://github.com/mongodb/mongo-azure/ - Anonymous
November 23, 2016
The comment has been removed - Anonymous
March 31, 2017
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...- Anonymous
April 01, 2017
HadrienMonogDb is fully available on Azure see https://docs.mongodb.com/ecosystem/platforms/windows-azure/ and there are images available in the Azure Marketplace for VM deployment see https://azuremarketplace.microsoft.com/en-us/marketplace/apps/bitnami.mongodb and details on creating sharded clusters see https://azure.microsoft.com/en-gb/resources/templates/mongodb-sharding-centos/
- Anonymous
- Anonymous
June 27, 2017
MongoDB Atlas is now available on Azure as a database as a service offering supported and maintained by MongoDB.https://www.mongodb.com/cloud/atlas- Anonymous
June 29, 2017
Robert Yes there are now lots of options for MongoDB on Azure We have prebuilt images on the Azure MarketPlaceMongoDB https://azuremarketplace.microsoft.com/en-us/marketplace/apps/bitnami.mongodb?tab=Overview MongoHQ https://azuremarketplace.microsoft.com/en-us/marketplace/apps/aad.mongohq?tab=OverviewMongoDB with Replication https://azuremarketplace.microsoft.com/en-us/marketplace/apps/bitnami.production-mongodb?tab=OverviewDatabase as service for MonogoDB https://azuremarketplace.microsoft.com/en-us/marketplace/apps/Microsoft.DocumentDB_MongoDB_Support?tab=OverviewMongoDB VM https://docs.microsoft.com/en-us/azure/virtual-machines/windows/install-mongodb
- Anonymous