If you’ve built a medium-sized to large-scale web application in the last few years, you probably considered basing it on the open source LAMP or MEAN stack. The older LAMP stack uses the Linux operating system, Apache web server, MySQL relational database, and PHP programming language. MEAN uses the MongoDB NoSQL database, the Express back-end web application framework, the Angular application platform, and the Node.js JavaScript runtime. MEAN is essentially an end-to-end JavaScript stack. Linux isn’t explicitly mentioned in the acronym, but is usually the OS underneath Node.
In this review, I’ll discuss the MongoDB database, now at version 4. MongoDB is a highly scalable, operational database available in both open source and commercial enterprise versions, and it can be run on-premises or as a managed cloud service. The managed cloud service is called MongoDB Atlas.
MongoDB is far and away the most popular of the NoSQL databases. Its document data model gives developers great flexibility, while its distributed architecture allows for great scalability. As a result, MongoDB is often chosen for applications that must manage large volumes of data, that benefit from horizontal scalability, and that handle data structures that don’t fit the relational model.
Because MongoDB is appropriate for a wide variety of use cases, it is often put forth as a replacement for relational databases. However, while freedom from rigid schema constraints is often beneficial, it’s important to keep in mind that no document database is a universal solution—not even MongoDB.
MongoDB origins
The company behind MongoDB was founded in 2007 as 10gen by a team that was behind DoubleClick, the Internet advertising company. The original motivation for the MongoDB database was to be able to handle the agility and scale required for Internet advertising. As an example of scale, DoubleClick served 400,000 ads per second in 2007, and struggled to perform with the existing databases of the time.
MongoDB is a document-based store that also has a graph-based store implemented on top of it. The other kinds of NoSQL databases are key-value stores and column-based stores. All kinds of NoSQL databases share the ability to scale out in ways that were not possible in the SQL relational databases of 2007, but the different varieties of NoSQL databases have different strengths, weaknesses, and use cases.
Some of the main NoSQL competitors to MongoDB as operational databases are Amazon DynamoDB (key-value store), Google Cloud BigTable (column store), Google Cloud Datastore (document store), Redis (in-memory, key-value store), Couchbase (multi-model key-value and document store), DataStax/Cassandra (column store), and Azure Cosmos DB (multi-model including a SQL option as well as several NoSQL stores).
What is MongoDB?
MongoDB Inc. describes MongoDB as “a document database with the scalability and flexibility that you want with the querying and indexing that you need.” To parse that, we first need to understand the nature of a document database, which is one of the kinds of NoSQL designs.
Rather than storing strongly typed data in related normalized tables with fixed schemas like a relational database, a document database stores related data in de-normalized form embedded in JSON-like name-value documents. MongoDB doesn’t actually store JSON, however: MongoDB stores BSON (Binary JSON), which extends the JSON representation (strings) to include additional types such as int, long, date, floating point, decimal128, and geospatial coordinates, as shown in the diagram below. BSON documents contain one or more fields, and each field contains a value of a specific data type, including arrays, binary data, and subdocuments. BSON also tracks the size of each document, to allow efficient seeking.
https://goo.gl/4tzJQ5
No comments:
Post a Comment