A Beginner’s Guide to MongoDB

MongoDB is an open-source, document-based NoSQL database

Somnath Musib
Level Up Coding
Published in
8 min readNov 2, 2019

--

MongoDB (Image Courtesy: Google Images, labeled for reuse)

Overview

MongoDB is an open-source, document-based NoSQL database. It stores data in a JSON-like format with enterprise-grade features such as high availability, scalability, and security.

The following are a few notable features of MongoDB database:

  1. It is an open-source, cross-platform, NoSQL, document-based database.
  2. There is no concept of database schema like relational databases. Data is stored as collections and documents.
  3. There are no complex joins between collections which are usually done in relational database tables. A join is generally performed while storing the data by combining the documents.
  4. Data is stored in BSON format (Binary encoding of JSON-like documents).
  5. Data stored in collections need not have a similar structure. One document can have a certain set of fields, whereas another document can have a completely different set (both type and amount) of fields.
  6. MongoDB provides a default database named test. If there is no database selected while storing data, MongoDB uses this database to store data.

Installing MongoDB

In this section, we will talk about the installation of MongoDB on a local computer. MongoDB is available in two flavors:

  1. Community Edition
  2. Enterprise Edition

The Community edition of MongoDB is open-sourced and freely available. Enterprise edition is licensed and is available with an array of enterprise-grade features with commercial support.

Step by step instructions on how to download and install the MongoDB community edition can be found here. At the time of installation, MongoDB provides an option to install MongoDB Compass, a GUI console to access MongoDB databases. Alternatively, the MongoDB database can be accessed from the command line shell as well.

The following is the command-line interface of MongoDB:

--

--

Software Developer, Cloud Architect | Author "Spring Boot In Practice" . Find more at https://musibs.github.io