MongoDB is a non-relational document database that provides support for JSON-like storage. The MongoDB database has a flexible data model that enables you to store unstructured data, and it provides full indexing support, and replication with rich and intuitive APIs.
Below is an example of a JSON-like document in a MongoDB database:
{
company_name: "ACME Limited Foodstuffs",
address: {street: "1212 Main Street", city: "Springfield"},
phone_number: "1-800-0000",
industry: ["food processing", "appliances"]
type: "private",
number_of_employees: 987
}
AWS enables you to set up the infrastructure to support MongoDB database deployments in a flexible, scalable, and cost-effective manner on the AWS Cloud. AWS also enables you to run MongoDB-compatible workloads with Amazon DocumentDB (with MongoDB compatibility), a fast, scalable, and fully managed non-relational database service. With Amazon DocumentDB you don’t have to worry about operational hassle including hardware provisioning, backups, upgrades, durability, patching, high availability, and more. As a cloud-native database, Amazon DocumentDB enables you to build applications that can quickly and easily scale with your workload.
MongoDB database features
MongoDB has become popular with developers in part due to the its intuitive API, flexible data model, and features that include:
Ad-hoc queries
MongoDB supports field, range, and regular-expression queries which can return entire documents, specific fields of documents, or random samples of results.
Indexing
Fields in a MongoDB document can be indexed with primary and secondary indices. MongoDB supports a number of different index types, including single field, compound (multiple fields), multikey (array), geospatial, text, and hashed.
Replication
MongoDB provides high availability with replica sets including two or more copies of the data. Writes are handled by the primary replica, while any replica is capable of serving read requests. If the primary replica fails, a secondary replica is promoted to become the primary replica.
Learn more about MongoDB APIs, Operations, and Data Types supported in Amazon DocumentDB in the documentation.
Running MongoDB workloads in Amazon DocumentDB (with MongoDB compatibility)
While the MongoDB document model offers flexibility and an intuitive API loved by developers, self-managing MongoDB databases is difficult, time-consuming, and expensive, especially as applications scale. AWS created Amazon DocumentDB (with MongoDB compatibility) as a fully managed and MongoDB-compatible document database service allowing you to use your existing MongoDB drivers, MongoDB clients, and tools with Amazon DocumentDB.
As a fully managed AWS database service, Amazon DocumentDB allows you to set up, secure, and scale MongoDB-compatible databases in the cloud without worrying about maintaining and patching database software, manually setting up and securing database clusters, running cluster management software, configuring backups, and monitoring production workloads.
You can migrate MongoDB workloads to Amazon DocumentDB using the AWS Database Migration Service (AWS DMS) and command line utilities like mongodump and mongorestore.
Advantages of running MongoDB workloads in Amazon DocumentDB (with MongoDB compatibility)
Amazon DocumentDB supports the MongoDB API, and there are specific benefits and advantages to running your MongoDB workloads on Amazon DocumentDB.
Scalability
Amazon DocumentDB decouples storage and compute, allowing each to scale independently so that you can easily scale read capacity to millions of requests per second. You can increase the read capacity to millions of requests per second by adding up to 15 low latency read replicas in minutes, regardless of the size of your data.
High Availability and Durability
Amazon DocumentDB is designed for 99.99% availability and makes your data durable across three Availability Zones (AZs) within a Region. In Amazon DocumentDB, continuous backup is enabled by default, providing 1 day of point-in-time restore (PITR).
Security and Compliance
Amazon DocumentDB runs in Amazon VPC, which allows you to isolate your cluster in your own virtual network. Amazon DocumentDB supports encryption at rest with AWS KMS, encryption in transit, role-based access control, and compliance certifications including PCI DSS, ISO 9001, 27001, 27017, and 27018, SOC 1, 2 and 3, and HITRUST, in addition to being HIPAA eligible.
AWS Service Integration
Amazon DocumentDB easily integrates with other AWS services to extend functionality, including Amazon CloudWatch for monitoring and alarms, AWS CloudTrail for audit logs, AWS Glue for ETL, and AWS Secrets Manager to name a few.
Amazon DocumentDB continues to improve compatibility with MongoDB workloads by working backwards from the capabilities our customers ask us to build. To learn more about the advantages of DocumentDB for MongoDB workloads, watch the AWS re:Invent presentation, Amazon DocumentDB Deep Dive.
Customers running MongoDB-compatible workloads in Amazon DocumentDB
"At Freshworks we use DocumentDB for our integrations platform to keep different products in sync with each other—for example your leads in Freshworks CRM with your marketing audiences at Mailchimp. We initially chose MongoDB as a document database to natively store, index, and query the JSON from this workload. Our applications run in multiple AWS regions to support global customers, and the legacy solution required 3 engineers to support new region deployments, hardware failure recovery, database sharding, and downtime-incurring maintenances to remove stale indexes. We migrated to Amazon DocumentDB because it manages launching, scaling, and recovering database clusters. We love that it’s compatible with MongoDB, so our applications didn’t require code changes, and we could easily spin up a DocumentDB cluster to test the MongoDB capabilities that we relied on. Now our engineers have more time to build new features for customers instead of managing databases.”
Vijay Lakshminarayanan, Senior Manager, Engineering - Freshworks
"At Hudl, we utilize a significant amount of AWS services, as we're always looking for opportunities to get out of the business of managing our own infrastructure. Our developers love the MongoDB API and document model. We're very excited about the launch of Amazon DocumentDB, as it fits perfectly into our short-term and long-term architectural plans. Amazon DocumentDB has the capabilities we're looking for, and it's great to see AWS Database Migration Service (DMS) support from day one."
Brian Kaiser, CTO - Hudl
“Woot! replaced our aging, self-managed, and operational nightmare product catalog database running on MongoDB 2.2 with Amazon DocumentDB. With only minimal changes, we were able to able to upgrade our driver and complete our full production migration in three weeks. In doing so, we cut our infrastructure costs for the database by 82%, including licensing costs. With Amazon DocumentDB, we’ve seen improved latency and scalability, and now have a safer backup solution and can perform point-in-time recovery to any second during a 35-day window. With AWS service integrations and improved scaling, we’re now able to stand up new features faster which enables us to innovate faster on behalf of our customers. We are thrilled to be out of the business of managing our own MongoDB database.”
Sam Giagtzoglou, Software Development Engineer – Woot!
Getting started
Check out the migration guide in the Amazon DocumentDB documentation.
Get started with the tutorial, "Migrating from MongoDB to Amazon DocumentDB"