MongoDB
MongoDB1 is a document-oriented database server, a type of NoSQL database that stores information as collections of documents. These documents use a format similar to JSON, and don’t (necessarily) have to adhere to a schema, which makes MongoDB suitable for unstructured data, and makes it easier to make changes to the data structure. In part for these reasons, document stores (with MongoDB at the forefront) have grown massively in popularity over the last decenium.
Comparison
Each of the requirements is scored on a scale from 1 (very poor) to 5 (very good).
Data integrity
Score: 4. Recent versions of MongoDB are ACID-compliant by allowing multi-document transactions. Although the database has all features necessary to ensure consistent data, MongoDB depends on denormalisation of data to perform optimally. As this results in duplicate data, extra care has to be taken by the application to ensure these stay in sync.
Handling necessary data
Score: 5. MongoDB shouldn’t have problems in managing a collection with millions of documents.
JavaScript support
Score: 5. The JavaScript-like query language and document format of MongoDB integrate with JavaScript very well. There is an official driver available, as well as support from many third-party libraries2 that offer additional functionality.
Performance
Score: 3. When used properly with denormalised data, MongoDB should be very performant. However, benchmarks3 show that it does generally lag behind PostgreSQL.
Query support
Score: 4. MongoDB uses a powerful JavaScript-based query language that includes advanced pipelines for aggregating data. However, as MongoDB is not intended to be relational, these are not intended to be used very regularly.
Scalability
Score: 4. Sharding is supported to distribute data between machines and increase the database’s capacity. However, shards have to be defined manually by carefully picking sharding keys to ensure an even distribution.