How to Connect to MongoDB Server

by Amit Biswas Posted Feb. 24, 2017

Before you start, make sure you know how to SSH to the server. Learn about that here.

If you are home (read: not connected to NYU wifi) you have to use NYU VPN). Scroll down the page to see the download link for the vpn client for your platform (Windows, Mac etc.). When the vpn client asks for the server address use vpn.nyu.edu and use your typical netid and password to authenticate.

Using the Terminal

First SSH to code.engineering.nyu.edu

Once logged in type in the following command:

mongo dbname -u dbuser -p

dbname and dbuser is given to you. It is usually the netid of the team leader. When prompted for password, simply type in the one given to you.

Using a Client

I will be using Robomongo to demonstrate how to setup a client.

When you first launch the client, you will be greeted with an empty list of servers.

netstat command
Figure 1. Robomongo Start Screen.

Click on Create. Then fill in the following details:

netstat command
Figure 2. Robomongo Connection Name.

Make sure Perform authentication is checked. Fill in the details as shown below. dbname, dbuser, and password is sent via email.

netstat command
Figure 3. Robomongo Connection Authentication.

Click on Test and you should see the following dialog box pop up.

netstat command
Figure 4. Robomongo Test Connection.

Now you will see the server that was just configured.

netstat command
Figure 5. Robomongo Connection List.

Hit Connect and you should see what is in your database.

netstat command
Figure 6. Robomongo Database View Connected.