What is MongoDB?
MongoDB is a document-oriented database in which data is stored as JSON-like documents.
MongoDB is designed to meet the needs of large data volumes, high performance, and flexibility.
MongoDB uses collections to organize documents, and each document is composed of key-value pairs.
- Database: A container for storing data, similar to a database in a relational database.
- Collection: A collection in a database, similar to a table in a relational database.
- Document: A data record in a collection, similar to a row in a relational database, stored in BSON format.
MongoDB stores data as a document whose data structure consists of key-value (key=>value) pairs. A document is similar to a JSON object, and field values can contain other documents, arrays, and arrays of documents:
Main Features
-
Document-oriented storage: MongoDB is a document-oriented database that stores data in a JSON-like format, making data structures more flexible and rich.
-
Index-optimized queries: MongoDB allows users to create indexes on any attribute in a document, such as
FirstNameandAddress, thereby improving query efficiency and sort performance. -
Data mirroring and scalability: By creating copies of data locally or over a network, MongoDB achieves powerful data redundancy and scalability.
-
Horizontal scaling and sharding: To handle increased load, MongoDB can distribute data across other nodes in a computer network through sharding, achieving horizontal scaling.
-
Powerful query language: MongoDB uses a JSON-formatted query syntax that supports complex query expressions, including queries on embedded objects and arrays.
-
Data updates: Uses
update()commands, MongoDB can replace an entire document or update specified data fields, providing a flexible way to update data. -
MapReduce batch processing: MongoDB's MapReduce feature is designed for large-scale data processing and aggregation operations, through the Map function's
emit(key, value)invocation and the Reduce function's logical processing, achieving efficient data summarization. -
MapReduce scripting: Map and Reduce functions are written in JavaScript and can be executed through
db.runCommandormapreducecommands in MongoDB. -
GridFS large-file storage: GridFS is a built-in MongoDB feature for storing and retrieving files larger than the BSON document size limit, such as images and videos.
-
Server-side script execution: MongoDB allows JavaScript scripts to be executed on the server, providing the ability to execute them directly on the server or store function definitions for later invocation.
-
Multi-Language Support: MongoDB provides support for many programming languages, including but not limited to RUBY, PYTHON, JAVA, C++, PHP, and C#.
-
Simple to install: MongoDB's installation process is simple and straightforward, allowing users to deploy and use it quickly.
History
| Version | Publish date | Feature description |
|---|---|---|
| 1.0 | August 2009 | More indexes per collection |
| Faster index creation | ||
| 1.2 | December 2009 | Map/Reduce |
存储的 JavaScript 函数
可配置的 fsync 时间
几个小特性和修复 |
| 1.4 | March 2010 | Production-ready sharding | | 1.6 | August 2010 | Replica sets
IPv6 support | | 1.8 | March 2011 | | | 2.0 | September 2011 | | | 2.2 | August 2012 | Enhanced geospatial support
Switch to the V8 JavaScript engine | | 2.4 | March 2013 | Security enhancements
Text search (beta)
Hashed index
Aggregation enhancements
Text search integration | | 2.6 | April 8, 2014 | Query engine improvements
New write operation protocol
Security enhancements
WiredTiger storage engine support
Pluggable storage engine API | | 3.0 | March 3, 2015 | SCRAM-SHA-1 authentication
Improved explain functionality
MongoDB Ops Manager
Enhanced replica set elections
WiredTiger storage engine by default | | 3.2 | December 8, 2015 | Configuration servers as replica sets
Read concern
Switch from V8 to SpiderMonkey
Linearizable read concern | | 3.4 | November 29, 2016 | Views
Collation | | 3.6 | November 2017 | | | 4.0 | June 2018 | Transactions | | 4.2 | August 2019 | | | 4.4 | July 2020 | | | 4.4.5 | April 2021 | | | 4.4.6 | May 2021 | Future-proof versioned API | | 5.0 | July 13, 2021 | Client-side field level encryption
Live resharding
Time series support | | 6.0 | July 2022 | | | 7.0 | August 15, 2023 | |
MongoDB download
You can download the installation package from the official MongoDB website at:https://www.mongodb.com/try/download/community。
MongoDB supports the following platforms:
-
Linux: MongoDB supports various Linux distributions, including but not limited to Ubuntu, Debian, CentOS, Red Hat Enterprise Linux (RHEL), Fedora, and so on.
-
Windows: MongoDB provides an official version for the Windows operating system that can run on Windows Server and Windows desktop operating systems.
-
macOS: MongoDB can run on macOS, and an official installer for macOS is provided.
-
Docker: MongoDB can also run as a Docker container, which makes deploying and managing MongoDB on various platforms more convenient.

Language support
MongoDB has the following official drivers:
MongoDB tools
There are several management tools available for MongoDB.
Monitoring
MongoDB provides the network and system monitoring tool Munin, which is applied to MongoDB as a plugin.
Gangila is a high-performance system monitoring tool for MongoDB, which is applied to MongoDB as a plugin.
Cacti is an open-source GUI-based tool for viewing CPU load and network bandwidth utilization; it also provides a plugin for monitoring MongoDB.
GUI
- Fang of Mongo - web-based, built with Django and jQuery.
- Futon4Mongo - a mongodb clone of the CouchDB Futon web interface.
- Mongo3 - written in Ruby.
- MongoHub - an application for OSX.
- Opricot - a browser-based MongoDB console written in PHP.
- Database Master - a mongodb management tool for Windows
- RockMongo - the best MongoDB management tool in the PHP language, lightweight, and supports multiple languages.
MongoDB application cases
The following lists some real-world applications of MongoDB by companies:
- Craigslist uses MongoDB to archive billions of records.
- FourSquare, a location-based social networking site, uses MongoDB on Amazon EC2 servers to share data.
- Shutterfly, an Internet-based social and personal publishing service, uses MongoDB for a variety of persistent data storage needs.
- bit.ly, a web-based URL shortening service, uses MongoDB to store its own data.
- spike.com, an affiliate of MTV Networks, uses MongoDB.
- Intuit, a provider of software and services for small businesses and individuals, uses MongoDB to track user data for small businesses.
- sourceforge.net, a resource site for finding, creating, and publishing free open-source software, uses MongoDB for backend storage.
- etsy.com, a website for buying and selling handmade items, uses MongoDB.
- The New York Times, one of the leading online news portals, uses MongoDB.
- CERN, the famous particle physics research institute, uses MongoDB for data from the Large Hadron Collider at the European Organization for Nuclear Research.