Getting Started with MongoDB

MongoDB is a very popular NoSQL database.

Installation

Use Homebrew to install the mongodb.

brew tap mongodb/brew
brew install mongodb-community@4.2

Run MongoDB (i.e. the mongod process) as a macOS service.

brew services start mongodb-community@4.2

To verify that MongoDB is running, search for mongod in your running processes.

ps aux | grep -v grep | grep mongod

We can view the log file to see the current status of your mongod process: /usr/local/var/log/mongodb/mongo.log.

To begin using MongoDB, connect a mongo shell to the running instance. From a new terminal, issue the following:

mongo
MongoDB Compass - GUI for MongoDB

Install the MongoDB Compass and use it.

Use the MongoDB

Show all the available databases

> show dbs