Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 1.21 KB

MongoDB_install.md

File metadata and controls

57 lines (40 loc) · 1.21 KB
title slug date status tags
Install MongoDB on MacOS
install-mongodb-macos
2017-03-05
publish
how-to
databases

tl;dr

# install Homebrew if not installed already
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# install
brew install mongodb

# add MongoDB to startup processes
brew services start mongodb

# create the `/data/db` directory, where mongo data will live
mkdir -p /data/db

# Make sure the `/data/db` directory has the right permissions
sudo chown -R `id -un` /data/db

# Run the mongo daemon
mongod
# sudo mongod

# `quit()` to quit, `ctrl+c` to exit

Using MongoDB Client CLI

# start mongo client
mongo 

mongo > help # see a list of commands available

mongo > show dbs # show all databases
mongo > use foo # use/switch to a database
mongo > show collections # show collections (like Tables in SQL dbs) in the database
mongo > db.foo.find() # show data inside a collection with `.find()`

Alternatively, you can use a free MongoDB management tool called Robomongo

Links