The minimal version of get started with mongodb 🌱 local development

Β·

1 min read

Reference

Install MongoDB on local machine

In case your OS is MacOS.

brew tap mongodb/brew
brew install mongodb-community

# check configuration
cat /opt/homebrew/etc/mongod.conf

# check log file
cat /opt/homebrew/var/log/mongodb/mongo.log

# start the MongoDB service
brew services start mongodb-community

# To verify that MongoDB is running
brew services list

# Try MongoDB shell
mongosh

Download compass tool - the GUI for MongoDB.

Or install compass by brew install --cask mongodb-compass command.

Connect MongoDB service on mongodb://localhost:27017 by that compass tool.

Clone data from remote MongoDB connection

mongodump --uri="mongodb://mongodb0.example.com:27017/db_name?retryWrites=true&w=majority&authSource=admin" [additional options]

mongodump is a utility for creating a binary export of the contents of a database.

mongorestore --uri="mongodb://localhost:27017/db_name" --db db_name dump/db_name

Open the compass tool again and view cloned data!