Professional Documents
Culture Documents
Data Model 2
Document Model 2
Graph Model 2
Key-Value and Wide Column Models 2
Query Model 3
Document Database 3
Graph Database 3
Key Value and Wide Column Databases 3
Consistency Model 4
Consistent Systems 4
Eventually Consistent Systems 4
APIs 5
Idiomatic Drivers 5
Thrift or RESTful APIs 5
SQL-Like APIs 5
Conclusion 7
We Can Help 7
Introduction
Relational databases have a long-standing position in most Development teams exert strong influence in the
organizations, and for good reason. Relational databases technology selection process. This community tends to find
underpin existing applications that meet current business that the relational data model is not well aligned with the
needs; they are supported by an extensive ecosystem of needs of their applications. Consider:
tools; and there is a large pool of labor qualified to
Developers are working with applications that create
implement and maintain these systems.
new, rapidly changing data types structured,
But organizations are increasingly considering alternatives semi-structured, unstructured and polymorphic data
to legacy relational infrastructure. In some cases the and massive volumes of it.
motivation is technical such as a need to handle new,
Long gone is the twelve-to-eighteen month waterfall
multi-structured data types or scale beyond the capacity
development cycle. Now small teams work in agile
constraints of existing systems while in other cases the
sprints, iterating quickly and pushing code every week
motivation is driven by the desire to identify viable
or two, some even multiple times every day.
alternatives to expensive proprietary database software
and hardware. A third motivation is agility or speed of Applications that once served a finite audience are now
development, as companies look to adapt to the market delivered as services that must be always-on, accessible
more quickly and embrace agile development from many different devices and scaled globally.
methodologies.
Organizations are now turning to scale-out architectures
These motivations apply both to analytical and operational using open source software, commodity servers and
applications. Companies are shifting workloads to Hadoop cloud computing instead of large monolithic servers and
for their bulk analytical workloads, and they are building storage infrastructure.
online, operational applications with a new class of
so-called NoSQL or non-relational databases.
1
When compared to relational databases, many NoSQL the need for expensive JOIN operations and complex,
systems share several key characteristics including a more multi-record transactions.
flexible data model, higher scalability, and superior
In a document database, the notion of a schema is
performance. But most of these NoSQL databases also
dynamic: each document can contain different fields. This
discard the very foundation that has made relational
flexibility can be particularly helpful for modeling
databases so useful for generations of applications
unstructured and polymorphic data. It also makes it easier
expressive query language, secondary indexes and strong
to evolve an application during development, such as
consistency. In fact, the term NoSQL is often used as an
adding new fields. Additionally, document databases
umbrella category for all non-relational databases. As we
generally provide the query robustness that developers
will see, this term is far too wide and loosely defined to be
have come to expect from relational databases. In
truly useful. It often ignores the trade-offs NoSQL
particular, data can be queried based on any combination
databases have made to achieve flexibility, scalability and
of fields in a document.
performance.
Applic
Applications:
ations: Document databases are general purpose,
In this paper, we hope to help you navigate the complex
useful for a wide variety of applications due to the flexibility
and rapidly evolving domain of NoSQL and non-relational
of the data model, the ability to query on any field and the
databases. We describe five critical dimensions
natural mapping of the document data model to objects in
organizations should use to evaluate these databases as
modern programming languages.
they determine the right choice for their applications and
their businesses. Examples: MongoDB and CouchDB.
2
unstructured data, as the database does not enforce a set customers by a certain size, or aggregations of customer
schema across key-value pairs. sales value by zip code or state.
Wide column stores, or column family stores, use a sparse, It is also common for applications to update records,
distributed multi-dimensional sorted map to store data. including one or more individual fields. To satisfy these
Each record can vary in the number of columns that are requirements, the database needs to be able to query data
stored. Columns can be grouped together for access in based on secondary indexes. In these cases, a document
column families, or columns can be spread across multiple database will often be the most appropriate solution.
column families. Data is retrieved by primary key per
column family.
Document Database
Applic
Applications:
ations: Key value stores and wide column stores
Document databases provide the ability to query on any
are useful for a narrow set of applications that only query
field within a document. Some products, such as
data by a single key value. The appeal of these systems is
MongoDB, provide a rich set of indexing options to
their performance and scalability, which can be highly
optimize a wide variety of queries, including text indexes,
optimized due to the simplicity of the data access patterns
geospatial indexes, compound indexes, sparse indexes,
and opacity of the data itself.
time to live (TTL) indexes, unique indexes, and others.
Examples: Riak and Redis (Key-Value); HBase and Furthermore, some of these products provide the ability to
Cassandra (Wide Column). analyze data in place, without it needing to be replicated to
dedicated analytics or search engines. MongoDB, for
instance, provides both the Aggregation Framework for
TAKEAWAYS
providing real-time analytics (along the lines of the SQL
All of these data models provide schema flexibility. GROUP BY functionality), and a native MapReduce
implementation for other types of sophisticated analyses.
The key-value and wide-column data model is opaque in
To update data, MongoDB provides a find and modify
the system - only the primary key can be queried.
method so that values in documents can be updated in a
The document data model has the broadest applicability. single statement to the database, rather than making
The document data model is the most natural and most multiple round trips.
productive because it maps directly to objects in
modern object-oriented languages.
Graph Database
The wide column model provides more granular access
to data than the key value model, but less flexibility than These systems tend to provide rich query models where
the document data model. simple and complex relationships can be interrogated to
make direct and indirect inferences about the data in the
system. Relationship-type analysis tends to be very
efficient in these systems, whereas other types of analysis
Query Model may be less optimal. As a result, graph databases are rarely
used for more general purpose operational applications.
3
several caveats. To perform an update in these systems, encouraged to issue idempotent queries that explicitly set
multiple round trips may be necessary: first find the record, the inventory level.
then update it, then update the index. In these systems, the
update may be implemented as a complete rewrite of the
entire record irrespective of whether a single attribute has
Consistent Systems
changed, or the entire record. Each application has different requirements for data
consistency. For many applications, it is imperative that the
TAKEAWAYS data be consistent at all times. As development teams have
worked under a model of consistency with relational
The biggest difference between non-relational databases for decades, this approach is more natural and
databases lies in the ability to query data efficiently. familiar. In other cases, eventual consistency is an
Document databases provide the richest query acceptable trade-off for the flexibility it allows in the
functionality, which allows them to address a wide systems availability.
variety of operational and real-time analytics
Document databases and graph databases can be
applications.
consistent or eventually consistent. MongoDB provides
Key-value stores and wide column stores provide a tunable consistency. By default, data is consistent all
single means of accessing data: by primary key. This writes and reads access the primary copy of the data. As
can be fast, but they offer very limited query an option, read queries can be issued against secondary
functionality and may impose additional development copies where data maybe eventually consistent if the write
costs and application-level requirements to support operation has not yet been synchronized with the
anything more than basic query patterns. secondary copy; the consistency choice is made at the
query level.
4
reasons, inserts tend to perform well in eventually documents or fields within documents. With other types of
consistent systems, but updates and deletes can involve interfaces it may be necessary to retrieve and parse entire
trade-offs that complicate the application significantly. documents and navigate to specific values in order to set
or get a field.
5
in new projects. It also helps organizations retain key
TAKEAWAYS technical talent. Lastly, a strong community encourages
other technology vendors to develop integrations and to
The maturity and functionality of APIs vary significantly
participate in the ecosystem.
across non-relational products.
Community Strength
There are significant advantages of having a strong
community around a technology, particularly databases. A
database with a strong community of users makes it easier
to find and hire developers that are familiar with the Figur
Figuree 1: MongoDB Nexus Architecture, blending the best
product. It makes it easier to find best practices, of relational and NoSQL technologies
documentation and code samples, all of which reduce risk
6
Relational databases have reliably served applications for innovations of NoSQL while maintaining the foundation of
many years, and offer features that remain critical today as relational databases.
developers build the next generation of applications :
Expr
Expressive
essive query language. Users should be able to Conclusion
access and manipulate their data in sophisticated ways
with powerful query, projection, aggregation and update
operators, to support both operational and analytical As the technology landscape evolves, organizations
applications. increasingly find the need to evaluate new databases to
support changing application and business requirements.
Secondary indexes. Indexes play a critical role in The media hype around non-relational databases and the
providing efficient access to data, for both reads and commensurate lack of clarity in the market makes it
writes, supported natively by the database rather than important for organizations to understand the differences
maintained in application code. between the available solutions. As discussed in this paper,
key criteria to consider when evaluating these technologies
Str
Strong
ong consistency
consistency.. Applications should be able to
are the data model, query model, consistency model and
immediately read what has been written to the
APIs, as well as commercial support and community
database. It is much, much more complicated to build
strength. Many organizations find that document databases
applications around an eventually consistent model,
such as MongoDB are best suited to meet these criteria,
imposing significant work on the developer, even for the
though we encourage technology decision makers to
most sophisticated development teams.
evaluate these considerations for themselves.
However, modern applications impose requirements not
addressed by relational databases, and this has driven the
development of NoSQL databases which offer: We Can Help
Flexible Dat
Dataa Model. NoSQL databases emerged to
address the requirements for the data we see We are the MongoDB experts. Over 2,000 organizations
dominating modern applications. Whether document, rely on our commercial products, including startups and
graph, key-value or wide-column, all of them offer a more than a third of the Fortune 100. We offer software
flexible data model, making it easy to store and combine and services to make your life easier:
data of any structure and allow dynamic modification of
MongoDB Enterprise Advanced is the best way to run
the schema without downtime.
MongoDB in your data center. Its a finely-tuned package
Elastic Sc
Scalability
alability.. NoSQL databases were all built of advanced software, support, certifications, and other
with a focus on scalability, so they all include some form services designed for the way you do business.
of sharding or partitioning, allowing the database to MongoDB Atlas is a database as a service for MongoDB,
scale-out on commodity hardware deployed on-premise letting you focus on apps instead of ops. With MongoDB
or in the cloud, allowing for almost unlimited growth. Atlas, you only pay for what you use with a convenient
High PPerformance.
erformance. NoSQL databases are designed to hourly billing model. With the click of a button, you can
deliver great performance, measured in terms of both scale up and down when you need to, with no downtime,
throughput and latency at any scale. full security, and high performance.
While offering these innovations, NoSQL systems have MongoDB Cloud Manager is a cloud-based tool that helps
sacrificed the critical capabilities that people have come to you manage MongoDB on your own infrastructure. With
expect and rely upon from relational databases. MongoDB automated provisioning, fine-grained monitoring, and
offers a different approach. With its Nexus Architecture, continuous backups, you get a full management suite that
MongoDB is the only database that harnesses the reduces operational overhead, while maintaining full control
over your databases.
7
MongoDB Professional helps you manage your
deployment and keep it running smoothly. It includes
support from MongoDB engineers, as well as access to
MongoDB Cloud Manager.
Resources
New York Palo Alto Washington, D.C. London Dublin Barcelona Sydney Tel Aviv
US 866-237-8815 INTL +1-650-440-4474 info@mongodb.com
2016 MongoDB, Inc. All rights reserved.