
A MongoDB White Paper MongoDB Architecture Guide: Overview October 2020 Table of Contents Industry Context 1 Document Model & MongoDB Query Language 2 Multi-Cloud, Global Database 5 MongoDB Cloud with Search, Data Lake, and Mobile 9 Conclusion and Next Steps 10 We Can Help 11 Resources 12 Industry Context Data and software are today at the heart of every business, However each workload has traditionally been powered but for many organizations, realizing the full potential of the by its own database, creating duplicated data silos digital economy remains a significant hallenge.c Since the stitched together with fragile ETL pipelines, accessed inception of MongoDB, we have believed the biggest by different developer APIs. challenge developers face comes from working with data: To address some of these challenges, non-tabular • Demands for higher productivity and faster time to (sometimes called NoSQL or non-relational) databases market are being held back by rigid relational data have seen rapid adoption over the past decade. But many models that are mismatched to modern code and of these NoSQL databases are simply bandaids, offering a impose complex interdependencies between niche set of functionality. engineering teams. The problem is that typical NoSQL databases do one or • An inability to work with, and extract insights from, two things well – they might offer more flexibility in the massive increases in the new and rapidly changing data model than traditional databases, or scale-out easily. structured, semi-structured, and polymorphic data But to do this they discard the most valuable features of generated by today’s applications. relational databases. They often sacrifice data integrity and • Monolithic and fragile legacy databases inhibiting the the ability to work with data in the ways needed to build wholesale shift to distributed systems and the cloud rich and valuable applications – whether these are new computing that deliver the resilience and scale digital touchpoints with an organizations’ customers, or demanded by digital business, while also meeting a modernized core backend business processes. whole new set of regulatory demands for data privacy. MongoDB was launched in 2009 as a completely new • Previously separate transactional, analytical, search, and class of general-purpose platform, and quickly established mobile workloads are converging to create rich, itself as the database most wanted by developers. This is data-driven applications and customer experiences. 1 because MongoDB takes the best of relational and NoSQL Documents and MongoDB databases, providing a technology foundation that enables customers to meet the demands of almost any class of Query Language: The Fastest modern application. Way to Innovate Built around JSON-like documents, document databases are both intuitive and flexible for developers to work with. They promise higher developer productivity, and faster evolution with application needs. As developers have experienced these benefits, the document data model has become the most popular alternative to the tabular model used by traditional relational databases. There are four primary advantages of the document data model. 1. Intuitive: Faster and Easier for Developers Documents in the database directly map to the objects in your code, so they are much more natural to work with. The following example JSON document in MongoDB Figure 1: MongoDB Cloud Platform demonstrates how a customer object is modeled in a single Three core architectural principles underpin MongoDB and document structure with related data embedded as drive our R&D investments: sub-documents and arrays. This approach collapses what would otherwise be seven separate parent-child tables 1. The document data model and MongoDB Query linked by foreign keys in a relational database. Language, giving developers the fastest way to innovate in building transactional, operational and { "_id": analytical applications. ObjectId("5ad88534e3632e1a35a58d00"), "name": { multi-cloud, global database 2. A , giving developers the "first": "John", freedom to run their applications anywhere with the "last": "Doe" }, flexibility to move across private and public clouds as "address": [ { "location": "work", requirements evolve – without having to change a single "address": { line of code. "street": "16 Hatfields", "city": "London", 3. The MongoDB Cloud, providing a unified developer "postal_code": "SE1 8DJ"}, experience for modern applications than span cloud to "geo": { "type": "Point", "coord": [ 51.5065752,-0.109081]}}, edge, in database, search, and the data lake, backed by ], comprehensive & integrated application services. "phone": [ { "location": "work", In this Guide, we provide an overview of MongoDB’s "number": "+44-1234567890"}, ], underlying architecture. "dob": ISODate("1977-04-01T05:00:00Z"), "retirement_fund": NumberDecimal("1292815.75") } 2 With the document data model, there is no need to As a result of these properties, you can serve many more decompose data across tables, run expensive JOINs, or classes of application with a single database. You can work integrate a separate ORM layer. Data that is accessed with documents using a single query language, giving you a together is stored together, so you have less code to write consistent development experience however you’ve chosen and your users get higher performance. to model your data. MongoDB stores data as JSON (JavaScript Object 2. Flexible Schema: Dynamically Adapt to Notation) documents in a binary representation called Change BSON (Binary JSON). Unlike most databases that store JSON data as primitive strings and numbers, the BSON A document’s schema is dynamic and self-describing, so encoding extends the JSON representation to include you don’t need to first pre-define it in the database. Fields additional types such as int, long, date, floating point, and can vary from document to document and you modify the decimal128. This makes it much easier for applications structure at any time, allowing you to continuously integrate using MongoDB to reliably process, sort, and compare new application functionality, without wrestling with data. disruptive schema migrations. If a new field needs to be added, it can be created without 4. Powerful: Serve any Workload affecting all other documents in the collection, without updating a central system catalog and without taking the An important difference between databases is the database offline. expressivity of the query language, richness of indexing, and data integrity controls. When you need to make changes to the data model, the document database continues to store the updated objects The MongoDB Query Language is comprehensive and without the need to perform costly ALTER TABLE expressive. Ad hoc queries, indexing, and real time operations, update a separate ORM middleware layer, and aggregations provide powerful ways to access, group, coordinate all of these changes across multiple developer, transform, and analyze your data. You can federate queries DBA, and Ops teams. Documents allow multiple versions of across your databases supporting transactional workloads the same schema to exist in the same table space. Old and and archived data in your data lake using the same new applications can co-exist. MongoDB Query Language and drivers, all using a single connection string. MongoDB also offers Schema Validation so you can enforce standards over each document’s structure. With With ACID transactions you maintain the same schema validation, you have control to apply data all-or-nothing and snapshot isolation guarantees you’re governance to a document schema when your application used to in relational databases, whether manipulating data enters production, while maintaining the benefits of a in a single document, or with MongoDB’s scale-out flexible data model in development. architecture, across multiple documents geographically distributed in multiple shards. 3. Universal: JSON Documents are Everywhere With strong data consistency, MongoDB eliminates the application complexity imposed by eventually consistent Lightweight, language-independent, and human readable, NoSQL systems. MongoDB’s consistency guarantees are JSON has become an established standard for data fully tunable, allowing you to balance data freshness communication and storage. Documents are a superset of against performance. all other data models so you can structure data any way your application needs – rich objects, key-value pairs, tables, geospatial and time-series data, and the nodes and edges of a graph. 3 Figure 2: Creating rich visualizations of your data with MongoDB Charts Working with Document Data a range of visualization tools and connectors to make this straightforward: To accelerate developer productivity, MongoDB provides native drivers for all popular programming languages and • MongoDB Charts is the fastest and easiest way to frameworks. Supported drivers include Java, Javascript, create visualizations of richly-structured JSON data. You C#/.NET, Go, Python, PHP, Scala, Rust and more. All can create graphs and build dashboards, sharing them supported MongoDB drivers are designed to be idiomatic with other users for collaboration, and embed them for the given programming language. This makes it much directly into your web apps to create engaging user more natural for developers to work with data than experiences. string-based languages like SQL, and eliminates the need • The MongoDB Connector for BI lets you use MongoDB for cumbersome and
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages14 Page
-
File Size-