Skip to content

Instantly share code, notes, and snippets.

@eveporcello
Last active July 8, 2018 00:14
Show Gist options
  • Save eveporcello/98f9e37a65f05b9d0866137d80ed9653 to your computer and use it in GitHub Desktop.
Save eveporcello/98f9e37a65f05b9d0866137d80ed9653 to your computer and use it in GitHub Desktop.

Mongo Local Setup

Typical Mongo Service (photo-share database)

mongodb://localhost:27017/photo-share

Installing mongo

brew install mongodb

Checking your services

brew services list

Starting the mongo service

brew services start mongodb

Connecting to the shell

mongo

Basic Shell Commands

  • Clear the shell: cls
  • Exit the shell: exit
  • List databases: show dbs
  • Use a Database (photo-share): use photo-share
  • show collections: show collections
  • list data in a collection (photos): db.photos.find().pretty()
  • drop a collection (photos): db.photos.drop()
  • drop a database : db.dropDatabase()

IDE Plugins

mLab

  1. Goto mLab
  2. Create an account
  3. Create a sandbox database.
  4. Create user for the database: test with password1
  5. Copy the database connection:
mongodb://test:[email protected]:15089/photo-share
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment