Home » MongoDB study notes – Install MongoDB Community on Mac using Docker

MongoDB study notes – Install MongoDB Community on Mac using Docker

by admin
MongoDB study notes – Install MongoDB Community on Mac using Docker

Problems to be solved in this article

Recently, I have to help a friend build a small website. Without back-end support, I have to do many things by myself.

Speaking of databases, this site is more familiar with Firebase, but small websites need to be installed on their own hosts and cannot be exposed to the outside world. They can only be installed on the local machine. After thinking about it, I found a database similar to Firebase. What will be helpful in the future is MongoDB.

MongoDB This part will be a series of articles, mainly notes written after watching the teaching video of Net Ninjia Complete MongoDB Tutorial.

Because Net Ninjia uses Windows as the operating system, and August uses Mac, you still have to spend time reading files and crawling articles. For example, how to install this article on Mac was almost researched through crawling, so I thought about it. After thinking about it, I decided to publish the article.

I don’t know how far this series of articles will go. After all, there is a Chinese New Year in the middle, and I have a lot of things to do before March, so I will take a look first.

Docker install MongoDB

Official documents

The main reason for choosing Docker is that you can ignore the OS under which MongoDB is installed and avoid a lot of trouble.

Docker needs to be installed on this machine first.

After installation, open the terminal and enter:

docker run –name mongo -p 27017:27017 -d mongodb/mongodb-community-server:latest

After the installation is successful, you will see that the Container is created. Enter the following command to see:

See also  6 recommended features of macOS Ventura - the menu interface is more similar to the iPhone, enhancing the convenience of connection and intercommunication | T Kebang

docker container ls

If not specified otherwise, the default PORT is 27017.

Install MongoDB Compass

MongoDB Compass is an official GUI that allows you to directly view the status of MongoDB.

Official documents

After selecting your own OS, click the download button on the file to install it.

MongoDB Compass connects to MongoDB

Open MongoDB Compass and you will see that the URI default is:


If PORT is set separately, it must be modified.

After confirming PORT, click Connect to connect to MongoDB.

Install MongoDB Shell

Official documents

Install directly using Brew here:

brew install mongosh

After the installation is successful, enter mongosh on the terminal and you will see the DB message.

Installed MongoDB Shell successfully


You may also like

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy