Skip to content

Instantly share code, notes, and snippets.

@ross-u
Created February 3, 2021 07:43
Show Gist options
  • Save ross-u/a2016ec8fe5e4f6b8e99a41be3456797 to your computer and use it in GitHub Desktop.
Save ross-u/a2016ec8fe5e4f6b8e99a41be3456797 to your computer and use it in GitHub Desktop.
Start MongoDB shell and commands

MongoDB shell and commands

Mongo shell is a CLI that we use to work with the Mongo database directly from the terminal.

Mongo shell uses JavaScript, therefore the syntax is the same as working with JS and calling methods.


Start MongoDB and Mongo shell - Ubuntu Linux

# Start the Mongo server - Linux
sudo systemctl start mongod

# Check the Mongo server status - Linux
sudo systemctl status mongod

# To open the Mongo Shell - Linux
mongo

Start MongoDB and Mongo shell - MacOS

# Start the Mongo server with Homebrew - MacOS
brew services start mongodb-community

# OR
# Start the Mongo server - MacOS
mongod

# OR
# Start the Mongo Shdbell - MacOS
mongo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment