Last Updated: February 25, 2016
·
5.872K
· suroorwijdan

Connect to remote MongoDB with your CLI

This is a very basic tip, many times you would want to connect to your QA, PROD mongo instance from your terminal.

You can do so with the following command.

mongo MONGOSERVERURL:27017

If you have authentication enabled, which you might obviously have:

mongo -u <user> -p <pass> --host <host> --port 27017