2011 will be remembered, because this year the SQL will die; this year, the relational database retreated from the first line; this year, developers discovered that they didn't have to convert each object into a table structure to persist data.
2011 is a document database year, despite the steady development momentum, through the past eight years of development, there are now a variety of stable document databases----from the Amazon and Google Cloud, to various open source tools, especially MongoDB.
So, what's MongoDB? Here are five things that every developer should know:
1) MongoDB is a stand-alone server;
Like MySQL or Postresql, MongoDB provides a listening port for access. It provides tools for querying, creating, updating, and deleting. Theoretically, you use it the same way: Connect, perform a task, and close the connection.
2 It is based on the document, not based on the table;
MongoDB has no structured language. If you want to create a new document type, you don't have to do anything to tell the database about the structure of the data, but just save it to a database.
Simply put, MongoDB uses a type of processing like JavaScript or PHP. In other words, the database is a flexible, weak type.
While some of the data is restrictive (chunks of data may require some explicit processing), in most cases you can write your MongoDB code as you would write PHP code.
(3) It is unstructured;
Remember these database abstraction layers you wrote? Remember those ORM layers you've been working on? Now, you can discard them all. You don't need them in the MongoDB. MongoDB not many query statements. In most cases, just give it an array to specify the information you want, and then it will give you an array of documents to return. If you want to run some very complex queries (such as map-reduce operations), you can pass JavaScript to MongoDB, and its internal JavaScript engine can parse the script.
4 Do not need to learn another query language;
The development time is also short because there is no structure to manage and little (if any) data maps.
The learning curve is smooth because there is no new query language to learn. The code is concise. After all, encapsulation can be very simple without any other ORM. Your code is a guarantee for the future. It's easy to add more fields to your object. So, as the requirements change, you can quickly modify the code to accommodate it.
MongoDB is enough to make me realize that it has the potential to change the rules of the game. This is why you should advocate using a new generation of document databases instead of sql-based relational databases. Leaving relational databases in the dust is more likely to do what they do well: store data that belongs to rows and tables.
MongoDB is a document-oriented database developed in C + +, that is, the anti-traditional database paradigm to design, the relevant objects are recorded in a document, each document is Schema-free, that is, the column name can be freely defined, more flexible, Especially in the face of the changing business logic of the application scene is very power. Data is stored in Bson (like JSON) format binary. The bad part is that it can bring some data redundancy and storage overhead.
In addition, the MongoDB indexing mechanism is the same as that of MySQL, which can use the experience of traditional relational databases to MongoDB indexes.
Unlike many other NoSQL products developed by individual engineers based on application scenarios, MongoDB is maintained by a dedicated company 10gen. One thing to note is that MongoDB itself does not manage memory, can not specify the size of memory, completely to the operating system to manage, so sometimes is not controllable, in the production environment to use at the OS level to monitor memory usage.
5 It has strong mainstream development language support, such as C #, C + +, Java, PHP, Perl, Python, Ruby.