MongoDB Features
This article looks at the features of MongoDB.
The main features, also described on the official site, can be summarized as follows.
- Document database (NoSQL)
- Special queries
- High performance
- High availability
- Horizontal scalability
Document database (NoSQL)
MongoDB is a document-format database that can store key-value combinations as they are, like JSON. Values can take many forms. For example, it can store numbers and strings, as well as arrays and objects. These value types can also be changed dynamically, and multiple types can be placed under the same field name. In other words, it is a schemaless document database.
Performance
The following features are implemented to provide performance.
- Reduced I/O processing through embedded data models
- Index support
One of MongoDB’s characteristics is that it supports indexes even though it is NoSQL. You can also specify a unique key in relation to indexes.
Special queries
MongoDB searches the database using special queries specified in JSON format. Queries can perform basic CRUD operations as well as the following distinctive operations.
- Aggregation and Map-Reduce
- String search using text indexes
- Geospatial queries
Aggregation and Map-Reduce can perform various statistics on stored data. Query assembly is implemented in a distinctive way, so it takes some getting used to, but the processing order is pipelined, which makes the code easier to follow.
Geospatial queries can use the built-in GeoJSON format to search for points within a range.
Availability
MongoDB provides replication through a feature called replica sets. Replica sets provide automatic failover and data redundancy.
Horizontal scaling
Horizontal scaling means that performance can be improved by adding machines. MongoDB provides horizontal scalability through a core feature called sharding.
Support for multiple storage engines
MongoDB supports multiple storage engines. In addition to commonly used file systems, you can choose an in-memory engine. It also exposes a storage engine API, so third-party storage engines can be created.