Mongodb:the Definitive Guide CHAPTER 1 Introduction

Source: Internet
Author: User

MongoDB is a powerful, flexible, and scalable data store. It combines the ability to scale out with many of the most useful features of relational databases, such as secondary Inde Xes, range queries, and sorting. MongoDB is also incredibly featureful:it have tons of useful features such as built-in support for Mapreduce-style Aggrega tion and geospatial indexes.

There is no point in creating a great technology if it's impossible to work with, so a lot of effort have been put into MAK ing MongoDB easy-to-get started with and a pleasure to use. MongoDB has a developer-friendly data model, administrator-friendly configuration options, and Natural-feeling language APs is presented by drivers and the database shell. MongoDB tries to get out of your-on-the-letting, instead of worrying about storing data.

A Rich Data Model

MongoDB is a document-oriented database, not a relational one. The primary reason for moving away from the relational model was to do scaling out easier, but there was some other Advan Tages as well.

The basic idea was to replace the concept of a "row" with a more flexible model, the "document." By allowing embedded documents and arrays, the document-oriented approach makes it possible to represent complex Hierarchi Cal relationships with a single record. This fits very naturally into the the-developers in modern object-oriented languages think about their data.

MongoDB is also schema-free:a document's keys is not a predefined or a fixed in any. Without a schema to change, massive data migrations is usually unnecessary. New or missing keys can dealt with at the application level, instead of forcing all data to the same shape. This gives developers a lot of flexibility on how they work with evolving data models.

Easy Scaling

Data set sizes for applications is growing at a incredible pace. Advances in Sensor technology, increases in available bandwidth, and the popularity of handheld devices that can be connected to the Internet has created an environment where even small-scale applications need to store more data than Many databases were meant to handle. A terabyte of data, once an unheard-of amount of information, was now commonplace.

As the amount of data, developers need to store grows, developers face a difficult decision:how should they s Cale their databases? Scaling a database comes down to the choice between scaling up (getting a bigger machine) or scaling out (partitionin G Data across more machines). Scaling up was often the path of least resistance, but it had draw-backs:large machines is often very expensive, and even tually a physical limit is reached where a more powerful machine cannot is purchased at any cost. For the Type of large Web application., people aspire to build, it's either impossible or Not cost-effe Ctive to run off of the one machine. Alternatively, it's both extensible and economical to scale out:to add storage space or increase performance, can BU Y another commodity Server and add it to your cluster.

MongoDB is designed from the beginning to scale out. Its document-oriented data model allows it-automatically split up data across multiple servers. It can balance data and load across a cluster, redistributing documents automatically. This allows developers to focus on programming the application and not scaling it. When they need more capacity, they can just add new machines to the cluster and let the database figure out how to Organiz E everything.

Tons of Features ...

It ' s difficult to quantify what a feature is:anything above and beyond what a relational database provides? Memcached? Other document-oriented databases? However, no matter what's the baseline is, MongoDB have some really nice, unique tools. R solution.

Indexing
MongoDB supports generic secondary indexes, allowing a variety of fast Queries,and provides unique, compound, and Geospati Al indexing capabilities as well.

Stored JavaScript
Instead of stored procedures, developers can store and use JavaScript functions and values on the server side.
Aggregation
MongoDB supports MapReduce and other aggregation tools.
Fixed-size Collections
Capped collections is fixed in size and is useful for certain types of data, such as logs.
File Storage
MongoDB supports an easy-to-use protocol for storing large files and file metadata.

Some features common to relational databases is not present in MongoDB, notably joins and complex multirow transactions. These is architectural decisions to allow for scalability, because both of those features is difficult to provide effici Ently in a distributed system.

... Without sacrificing speed

Incredible performance is a major goal for MongoDB and have shaped many design decisions. MongoDB uses a binary wire protocol as the primary mode of Interaction with the server (as opposed to a protocol with More overhead, like http/rest). It adds dynamic padding to documents and preallocates data files to trade extra space usage for consistent Perfo Rmance. It uses memory-mapped files in the default Storage engine, which pushes the responsibility for memory management to T He operating system. It also features a dynamic query optimizer that "remembers" the fastest a-to perform a query. In short, almost every aspect of MongoDB is designed to maintain high performance.

Although MongoDB is powerful and attempts-keep many features from relational systems, it's not intended-do Everythi ng that a relational database does. Whenever possible, the database server offloads processing and logic to the client side (handled either by the drivers or By a user ' s application code). Maintaining this streamlined (streamlined; improved) design is one of the reasons MongoDB can achieve such high performance.

Simple administration

MongoDB tries to simplify database administration by making servers administrate themselves as much as possible. Aside from starting the database server, very little administration is necessary. If a master server goes down, MongoDB can automatically failover (fail-over redundancy) to a backup slave and promote the slave to a master . In a distributed environment, the cluster needs to being told only that a new node exists to automatically integrate and Conf Igure it.

MongoDB ' s administration Philosophy (philosophical; philosophy; life) is the server should handle as much of the configuration as possible a Utomatically, allowing (but not requiring) the users to tweak their setups if needed.

But Wait, that's not all ...

Throughout the course of the book, we'll take the time to note the reasoning or motivation behind particular decisions m Ade in the development of Mongodb.through those notes we hope to share the philosophy behind MongoDB. The best of the summarize the MongoDB project, however, is through its main focus-to create a full-featured data store tha T is scalable, flexible, and fast.

Mongodb:the Definitive Guide CHAPTER 1 Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.