All good CMS that run with MongoDB

archive

MySQL now offers numerous features as well as tried-and-tested administration tools and is particularly convincing with its cost advantages, stability and high level of security. But for some years now, experts have been questioning the concept of relational databases. This means that MySQL is getting more and more competition from innovative database solutions that are also made available as open source and pursue a completely new approach.

The keyword is "NoSQL". In contrast to what is initially obvious, the term does not stand for "no SQL", but for "not only SQL". The unclear name should not be understood as a challenge to traditional databases. Rather, the aim is to sensibly supplement relational databases where they show deficits. The NoSQL concept arose as an answer to the inflexibility and relatively difficult scalability of classic database systems. In these, the data must be stored according to a highly structured model.

In times of Web 2.0, cloud computing and social networks, the amount of data in web applications is growing dramatically. As a result, the requirements for data throughput and scalability of the underlying databases continue to increase. A prime example of this problem is Twitter. As the US blog "TechCrunch" reported in June 2011, the IT landscape of the popular information network now has to cope with around 200 million tweets a day. A year earlier it was "only" 65 million. In such data-intensive applications, relational databases usually suffer from performance problems and often reach their limits. For this reason, Twitter is now also using NoSQL solutions in addition to MySQL to improve the availability and performance of its service.

The challenger: what is MongoDB anyway?

In the meantime, numerous NoSQL solutions have emerged from the open source warehouse. The website http://www.nosql-database.org, supervised by Stefan Edlich, professor at the Beuth University of Applied Sciences in Berlin, offers a good overview of these solutions. The best-known representatives of the new database generation include "Redis", "Apache Cassandra" and "CouchDB" as well as MongoDB.

The system was presented to the public as an open source solution by the American startup 10gen in 2009 after around two years of development. The name, which takes a bit of getting used to, comes from the English term "humongous", which can be translated into German as "gigantic" or "huge". The solution is based on the C ++ programming language and is available for the Windows, Mac OS X and Linux operating systems. Both 32-bit and 64-bit systems are supported. MongoDB was honored this year as one of the best open source solutions in the prestigious "Bossie Awards" of the US-American CW sister publication "Infoworld". As the manufacturer explains, the solution is designed for high performance, large amounts of data, high flexibility and easy scalability.

In the three years of its market presence, MongoDB, version 2.0 of which is available free of charge today, has already convinced well-known companies of its advantages. Successful web applications that are used by millions of users worldwide use the young solution in critical production environments. These include the location-based social network Foursquare, the online network for urban classified ads Craigslist, the URL shortening service Bit.ly and the music streaming service Grooveshark.

Tables are obsolete - documents as data records

The MongoDB non-relational database stores records in the form of documents in JSON format. These are very similar to Javascript objects. The key difference to MySQL is that MongoDB is document-oriented. Document-based databases are designed for a schema-free structure. With MongoDB there is no fixed table schema and therefore, for example, no mandatory relation tables and "joins", which are becoming more and more complex with the further development and expansion of the database. Instead, relations can either be saved directly in the data record or, if necessary, created individually when querying the data. This means that the data structure is much more flexible than with MySQL and can easily be scaled horizontally.

Instead of tables, MongoDB speaks of collections. Each collection can contain documents analogous to rows or data records in a MySQL table. Documents are saved and output in the so-called BSON format. They are then very similar to Javascript objects. The format is derived from the compact JSON format (Javascript Object Notation) and, as the prefix "Binary" (Binary JSON = BSON) suggests, is designed for a low-overhead representation of binary data objects. Each document can have any number of fields, while a nested array structure is also possible. In addition, documents can also be saved within a document.

With all of these differences, MongoDB and MySQL also have some key similarities. Both database solutions use a unique ID per data record as the primary key, while in both cases select-relevant columns can be indexed in order to increase the performance when querying these fields. These similarities help to make it easier for experienced MySQL developers to get started with MongoDB. MongoDB, however, does without a query language such as SQL. Instead, the data is manipulated and queried using object-specific methods that are available for all common programming languages. One of the main advantages of MongoDB in the eyes of developers is the underlying object-oriented data model, which fits in better with traditional programming languages ​​than relational databases like MySQL do. In the course of the years numerous solutions in the area of ​​ORM ("Object Relational Mapping") have been established, which map data from a relational database in objects that are then easier to process in the program code.

MongoDB dispenses with a query language

MongoDB does not have a query language like SQL for CRUD (Create, Read, Update, Delete) operations and data queries. Instead, these operations are operated by object-specific methods of the respective programming language, which are summarized in various client APIs, called "drivers". Developers benefit from the typical advantages of ORM tools without having to use additional tools and without having to worry about compatibility problems. MongoDB supports all programming languages ​​commonly used on the web, including Javascript, PHP, Perl, Ruby, Python and Java. All available client drivers can be downloaded free of charge from the MongoDB website. (ba)

Diego Wyllie is a freelance journalist in Munich.

MySQL can score points over MongoDB with numerous proven administration tools. But with the online tool "MongoDB Monitoring Service" published in September 2011, Mongo has caught up at this point. The comparison between a system like MySQL, which has been used successfully for over a decade, and a solution like MongoDB, which has only just been Three years on the market may seem unfair at first glance. Of course, MySQL can score points over the newcomer in terms of functionality, availability of additional tools and developer documentation.

However, as the term Not only SQL (NoSQL) suggests, the two database systems are not necessarily in direct competition with one another, but can complement one another. Nevertheless, when it comes to persistent data storage in web applications, relational databases are no longer the only alternative. For their own projects, developers today would be well advised to compare the advantages and disadvantages of the two systems and according to their own requirements and priorities to rate. Does the system have to be able to handle large amounts of data efficiently? Are there high demands on the scalability and flexibility of the database? Should it be possible to distribute the data over several servers? Are frequent changes to the data structure to be expected in the future? If you answered yes to most of these questions, then you should at least take a closer look at MongoDB.