mongoDb or documentDB ? Which one ? Are you confused ? Let me sort that confusion for you.
Lets see what amazon has to say ?
Amazon claims that migrating from MongoDB to DocumentDB is “as easy as changing the database endpoint to the new Amazon DocumentDB cluster”
Ok,
Now lets see what Mongo has to say ?
One of the reviews I came across for MongoDB Atlas – “It is the fully-managed, global cloud database service for modern applications. Best-in-class automation and proven practices guarantee availability, scalability, and compliance with the most demanding data security and privacy standards. You can run Atlas on AWS, Google Cloud, and Azure or you could choose to run on all three at once. With multi-cloud clusters in Atlas, you can take advantage of unique tools and services native to all three major cloud providers without any added complexity to the data management experience.”
mongoDb
MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need. MongoDB’s document model is simple for developers to learn and use, while still providing all the capabilities needed to meet the most complex requirements at any scale. They provide drivers for 10+ languages, and the community has built dozens more.
The following platforms are available from mongoDB :
- MongoDB Atlas – Database as a service.
- MongoDB Cloud Manager – A cloud-based hosted operations management solution for MongoDB.
- MongoDB Ops Manager – Enterprise operations management solution for MongoDB: includes Automation, Backup, and Monitoring.
- MongoDB Drivers – The documentation available for the drivers for use with MongoDB.
Amazon documentDb
The company describes documentDb as “fast, scalable, highly available and fully managed“. With Amazon’s documentDb 4.x launch, you can now use atomic, consistent, isolated, and durable (ACID) transactions, open a change stream cursor for a database or cluster, and much more.
Points of comparison :
Amazon’s documentDb claims its fully managed, meaning offer database as a service, but mongoDb also has a platform mongoDb Atlas which is also providing database as a service . Ok, both are competent enough. Let’s get a little more in depth to first understand what are some unique features we will need to use for our project and let’s also see how each one scores on this.
Pricing :
MongoDB Atlas offers a free tier for developers to get the database setup up and running without having to enter credit card details. This is definitely encouraging for developers since price is a factor which one might not want to invest in trying out and experimenting to check if this product fits the use case better.
Let’s now see what is amazon document DB’s pricing,
The cheapest DocumentDB instance starts at a relatively sharp price before adding I/O costs.
Cloud compatibility:
We are living in the era of cloud adoption , where businesses are using a multi-cloud approach. MongoDB atlas‘s data distribution and mobility across AWS, Azure, and Google Cloud is noteworthy.
Whereas with Amazon’s DocumentDB, we might need to end up with a single cloud provider may be a disadvantage if you are looking for a multi-cloud approach in your company’s setup. If you are sure you will stick to one cloud itself, then this might not be an intensive point of consideration for you to choose in terms of portability – choice of cloud.
Features :
AWS claims DocumentDb as having “MongoDB compatibility” , but there are some of the features that it doesn’t have when compared to MongoDB . DocumentDB is not based on the MongoDB server. Rather it emulates the MongoDB API, and runs on top of Amazon’s Aurora backend platform. This creates significant architectural constraints, functionality limitations, and broken compatibility.
DocumentDB claims to support the MongoDB 4.0 API, which implies that it is at parity with MongoDB v4.0, released back in June 2018. In actual fact the DocumentDB 4.0 feature set most closely resembles early MongoDB 3.0 and 3.2, released in 2015, and compatibility testing reveals it fails 63% of the MongoDB API correctness tests. Applications written for MongoDB will need to be re-written to work with Amazon DocumentDB.
Replication :
Amazon document DB provides Single primary constrained to a single region, with up to 15 replicas, whereas MongoDB – Global clusters, with up to 50 replicas per shard across multiple regions
Sharding :
Amazon document DB has No sharding, single primary only. Largest instance supports 30,000 concurrent connections. The MongoDB Atlas instance supports 128,000 concurrent connections. Full sharding support.
Let’s understand some more Functional Differences Between Amazon DocumentDB 4.0 and MongoDB 4.0.
“For example, Amazon DocumentDB 4.0 does not currently support the type conversion operators or the string operators that were introduced in MongoDB 4.0 “
Below are functional differences between Amazon DocumentDB 4.0 and MongoDB 4.0.
- Lookup with empty key in path: When a collection contains a document with empty key inside the array (e.g. {“x” : [ { “” : 10 }, { “b” : 20 } ]}), and when the key used in the query ends in an empty string (e.g. x.), then Amazon DocumentDB will return that document since it traverses all the documents in the array whereas MongoDB will not return that document.
- $setOnInsert along with $ in the path: The field operator $setOnInsert will not work in combination with $ in the path in Amazon DocumentDB, which is also consistent with MongoDB 4.0.
Conclusion
If you consider to go with documentDB , you will need to ensure your project doesn’t end up using some of the features of MongoDB which amazon doesn’t support as mentioned above. And in case your organisation is working on a single cloud approach , then you can consider the document DB , but do remember that documentDB is not a complete replacement of mongoDB but it’s just a partial replacement.