This article covers how to install MongoDB on Ubuntu 20.04 LTS using either the apt package manager or by downloading and installing through the archive. For more information, visit MongoDB's official documentation.
MongoDB is an open-source and cross-platform document-oriented database system written in C++. It stores data in collections of JSON-like, flexible documents and used to create powerful websites and applications.
Due to its scalability and high performance, it is used for building modern applications that require powerful, mission-critical and high-availability databases.
To Configure MongoDB on Ubuntu:
MongoDB default configuration file is located at /etc/mongod.conf.
By default, each user will have access to all databases and perform any action.
For production environments, it is recommended to enable the MongoDB authentication.
i. You can do it by editing the file /etc/mongod.conf:
$ nano /etc/mongod.conf
2. Add the following lines:
3. Save and close the file then restart the MongoDB service to apply the changes:
$ systemctl restart mongod
Advantages of MongoDB:
1. Absence of a schema
2. Based on the collections of various documents
3. A clear structure of every object
4. Highly scalable
5. Internal memory is used to store data, which lets us get data faster.
6. Data is stored as JSON objects.
7. MongoDB supports document-based queries