MongoDB is multiplatform documentation database. It belongs to a group of NoSQL databases and instead of traditional model of relational databases, which use tables, they use documents similar to JSON format (MongoDB indicates them as BSON) and dynamical database scheme. This enables the creation and integration of data for apps simply and faster. Software has open source license and is published under GNU Affero General Public Licence and Apache license.
MongoDB was originally developed by 10gen company, which is currently called MondoDB Inc. In November 2007 as component for planned product platform as a service. It became open source two years later. MongoDB is used as backend solution of many essential pages and services, among which belongs Craiglist, eBay, Foursquare, SourceForge, Viacom or New York Times. MongoDB is considered to be the most popular NoSQL database system.
Basic features of MongoDB
Orientation on documents. Instead of disintegration of business subject to amount of relational structures can MongoDB save business subject in minimal amounts of documents. For example, instead of saving the information about a title and author of the book in two relational structures, there exists an option title, author and other information regarding to a book to save into one and only document with the name Book. That can often be more intuitive and more practical for manipulation.
Ad hoc queries. MongoDB allows searching according to the field, comprehensive queries and even searching by the regular expressions. Queries can give back certain fields of the document and contain JavaScript functions defined by user.
Indices. Random field in MongoDB document can be indexed. Indices in MongoDB conceptually match to the indices in relational databases. Available are also secondary indices.
Replication. MongoDB provides high availability with the help of replica sets. Replica sets contain two or more copies of data. Each member of the set can at any moment hold the function of primary or secondary replica. Primary replicas do all the readable and writing operations implicitly. Secondary replicas maintain the copy of the data contained in primary replica with the help of built-in replication. If the primary replica fails, replica sets automatically executes the process of choosing the replacement from the secondary replicas. Secondary replicas can also manage the readable operations with maintaining the consistence.
Balancing the load. MongoDB uses horizonal scaling with the help of sharding. User can choose shard key, which then decides, how will the collection be distributed. Data are then divided to expansions on the base of shard key and they are distributed among more shards. Shard exists as a main and has one or two slaves. MongoDB can run on more servers and use load balancing or data duplication, so the system would run in a case of hardware error. Automatic configuration is easily set and even during the run of the database it is possible to add new computers.
Saving files. MongoDB can be used as file system and simultaneously use the load balancing and data replication across larger amounts of computers.
Advantages of using MongoDB
Efficiency. MongoDB is intended for saving huge amounts of information.
Flexibility. MongoDB is not based on schemes. In an individual document, you can have a random type of data.
Speed. MongoDB manages to answer about hundred times faster than relational database.
Data availability. Replications and gridFS help reaching maximal availability of data.
Scalability. Database is horizontally scalable. If it is necessary to process larger amount of data, it is possible to use distribution on several machines.
Full technical support. MongoDB Inc. provides complete professional support.
Disadvantages of using MongoDB
The absence of join support. MongoDB in comparison to relational databases, does not support joins. Their usage is possible to be replaced by manual coding but the execution can be slow and it can have negative impact on the efficiency.
High demands on memory. MongoDB gives key names for every pair of values. What’s more, because of the joins absence, it is needed to store the unnecessary data extra. That can lead to pointless waste of memory.
Limited size of data. Maximal size of file is 16 MB.
Limited nesting. We can use nesting of documents to hundred layers maximum.