Introduction to MongoDB, modeless document-based database

Source: Internet
Author: User
Tags failover

MongoDB's name comes from an adjective humongous (huge), which loses some precision in scaling up and processing large amounts of data quickly, said Merriman at the MONDODB conference in San Francisco: "You don't have to deal with complex financial matters, In the case of securities transactions, the consistency of data may not be guaranteed. " To learn more about MongoDB, see the 51CTO database channel recommended MongoDB, modeless document database introduction.

NoSQL databases are labeled with different uses, such as MongoDB and COUCHDB are document-oriented databases, but that doesn't mean they can be like JSON (JavaScript Object Notation, JavaScript Object tags) to store text documents as structured data.

JSON is considered a substitute for XML, a lightweight, text-based data-exchange standard that has human-readable characteristics as XML. A simple JSON data structure is called an object, and may include multiple data types, such as integers (int), strings (string), arrays (array), dates (date), objects (object), and byte arrays (ByteArray).

Document-oriented databases are significantly different from relational databases, where document-oriented databases store data using an organized file rather than rows to store data, and in MongoDB, a set of documents is considered a collection, and in a relational database, a collection of rows is considered a table.

But at the same time their operations are similar, the relational database uses the data from the Select,insert,update and delete operations tables, and the document-oriented database uses Query,insert,update and remove to do the same things.

The maximum size of objects in MongoDB is limited to 4MB, but the number of objects is unlimited, MongoDB can speed up the execution of operations through the cluster, and when the database becomes larger, you can add servers to the cluster to resolve performance issues.

Tony Tam, vice president of Wordnik Engineering, says his company has 5 million documents that were previously saved in the MySQL database. About 1.5TB, migrated to MongoDB one months ago, Wordnik specifically collects definitions and information for all words, so the amount of data is very large, and after migrating to MongoDB, Tony Tam says he feels more reassured.

Tam said that when using the MySQL database, the Wordnik project always seemed to be on the bumpy road, and the data table freezes sometimes even more than 10 seconds, which no one can tolerate. About 200 new words appear every day, we are responsible for collecting them, and we want to add 1500 examples to the database to show their usage, we want to write to the database in only 1 seconds. Tam said: "We do not care about consistency, and the results of the two users of the query does not have to be consistent, we are always doing the update, which we can not guarantee."

Wordnik system is like a huge online dictionary, there are many people at the same time online query, but at the same time we are doing updates, using MongoDB, we can maintain high-speed add data, do not worry about the database will be blocked. Tam had a speech at the Mondodb conference titled "Wordnik: From MySQL to MongoDB", saying that it took only a day to move from MySQL to MongoDB.

Extended Reading

MongoDB Logo

MONGO is a high-performance, open-source, modeless, document-based database that can be used in many scenarios to replace traditional relational databases or key/value storage methods. MONGO is developed using C + + and provides the following features:

Collection-oriented storage: suitable for storing objects and data in JSON form.

Dynamic query: MONGO supports rich query expressions. Query directives use a JSON-style tag to easily query objects and arrays embedded in the document.

Full index support: Includes embedded objects and arrays in the document. The query optimizer of MONGO parses the query expression and generates an efficient query plan.

Query monitoring: MONGO contains a monitoring tool to analyze the performance of database operations.

Replication and automatic failover: The MONGO database supports data replication between servers, supporting master-slave mode and inter-server replication. The primary goal of replication is to provide redundancy and automatic failover.

Efficient traditional storage: supports binary data and large objects such as photos or pictures.

Automatic sharding to support cloud-level scalability (in the early alpha phase): Automatic sharding supports a level of database clustering, adding additional machines dynamically.

The main goal of MongoDB is to set up a bridge between key/value storage (which provides high performance and high scalability) as well as traditional RDBMS systems (rich functionality), combining the advantages of both. According to the official website description, MONGO is suitable for the following scenarios:

Website data: MONGO is ideal for real-time inserts, updates and queries, as well as the replication and high scalability required for real-time data storage on the site.

Caching: Because of its high performance, MONGO is also suitable as a caching layer for the information infrastructure. After the system restarts, the persistent cache layer built by MONGO can avoid overloading the underlying data sources.

Large, low-value data: Storing some data in a traditional relational database can be expensive, and many times programmers often choose traditional files for storage.

Highly scalable scenario: The MONGO is ideal for databases made up of dozens of or hundreds of servers. Built-in support for the MapReduce engine is already included in the roadmap for MONGO.

Storage for objects and JSON data: The MONGO Bson data format is ideal for storing and querying in a document format.

Naturally, the use of MongoDB will also have some limitations, such as it does not fit:

A highly transactional system, such as a bank or accounting system. The traditional relational database is still more suitable for applications that require a large number of atomic complex transactions.

Traditional business intelligence applications: a BI database for a specific problem will produce highly optimized query methods. For such applications, the Data warehouse may be a more appropriate choice.

A problem that requires SQL

MongoDB supports operating systems such as OS X, Linux, and Windows, and provides drivers for the Python,php,ruby,java and C + + languages, as well as drivers for Erlang and. NET platforms.

Introduction to MongoDB, modeless document-based database

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.