Frequently Asked Questions

1.) I am not able to connect to my cluster through my Windows Command-Prompt or macOS/Linux Terminal, how to resolve this?

Step 1: Identify the error message you are getting in the console/shell:

Step 2: Relate your error from the given cases which learners usually encounter:

Case 1: Please ensure that your IP whitelist allows connections from your network

You might be getting err msg something like shown in the figure down below:

*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

Suggested Solution:

First, check whether you added (which also includes your current IP address) to your IP Access List under the Security->Network Access menu within your Atlas Cluster.

The following steps as been also demonstrated in the figure below:




Case 2: AuthenticationFailed: bad auth

Or, you might be getting err msg something like shown in the figure down below:

can’t connect to new replica set master [], err: AuthenticationFailed: bad auth : Authentication failed.

Suggested Solution:

In this above issue mostly there would be typo error of username or password. So, make sure that the password or username is correct and authentic.

Case 3: Connection attempt failed: SocketException: Connection refused

MongoDB shell version v4.2.3

connecting to: mongodb://

2020-02-18T23:15:25.465-0800 E QUERY [js] Error: couldn’t connect to server, connection attempt failed: SocketException: Error connecting to :: caused by :: Connection refused :



2020-02-18T23:15:25.468-0800 F - [main] exception: connect failed

2020-02-18T23:15:25.468-0800 E - [main] exiting with code 1

Suggested Solution:

  • Make sure MongoDB server is running and listening the port 27017 using netstat command

~ netstat -an | grep 27017

  • Secondly, make sure that your connection is not obstructed by a firewall or an anti-virus. If an antivirus is blocking connection requests to/from your local network, then try to allow Atlas access through your Antivirus settings menu. If a firewall is blocking your access, then try to connect from a different location such as your home network.

  • If the issue persists, we suggest you use the non-srv string (found in MDB version 3.4 or less) which you will find in your MongoDB Atlas account’s connection tab by changing the MongoDB version.

Hit Connect → I have the mongo shell installed → mongo shell version 3.4 or earlier.

Note: If your issue is not covered in any of the above cases, feel free to create a new post in the Community Forums under the MongoDB University M001: MongoDB-Basics category. We will be glad to help you.

Kindly follow the given instructions to create post regarding your issue

It’s helpful if you provide more information so we can help you.While your issue is similar to the original poster you might have other things going on.

  1. What errors are you getting when trying to connect to your mongod instance?
  2. Are you trying to connect to a local or remote instance?
    a. Can you connect locally using the mongo shell?
  3. Are you hosting MongoDB or are you using something like MongoDB’s Atlas?
  4. Is your bind_ip set correctly if you’re trying to access from a remote machine?
  5. If trying to connect remotely, are there any firewalls that might be stopping the connection from being made?

2.) I am unable to connect my Cluster through the IDE on the University Platform, what could possibly go wrong?

Solution: If none of the above-mentioned checks worked for you, please ensure the following:

  • You have pasted the command in the Terminal( bottom half of the IDE ) and NOT in the file editing section ( top half of the IDE ).
  • You have pressed enter/return after pasting the command in the Terminal
  • You have entered your password at the prompt and pressed enter after that, please note that the cursor won’t move from its initial position but please be rest assured that it is still taking the input. Please type in your password and press enter/return. This is the intended behavior of the IDE designed to protect your privacy and password.
  • You have replaced the “myFirstDatabase” placeholder in the connection string, as provided by Atlas by-default with “admin”
  • To ensure that you have successfully connected to the Atlas Cluster:
    • Please verify that the IDE is now showing the connected shard details as below:

MongoDB Enterprise atlas-********-shard-0:PRIMARY>

  • try this command: “show dbs”, and if it lists all the databases in your cluster, it means you are all set to proceed

3.) Error: “”$” is not available on this atlas tier”

Solution: The single biggest reason behind getting this error is that you probably have mistyped the command, which means you have to fix the typo to make it work.

Common issues that we have encountered in the past are:

  • Unnecessary “:” in a stage name. For example: “$project:” instead of “$project”.
  • Incorrect capitalization of stages. For example: “$Group” instead of “$group”.

4.) Incorrect answer for “Chapter 4: Advanced CRUD Operations Lab 2: Logic Operators”

Solution: The lab asks you to find the number of companies, which:

are either founded in the month of October OR the year 2004


are having the category code as “social” OR “web”

Also, please make sure that you don’t have any syntax error, like a missing parenthesis/bracket(“[ ]”, “( )”, “{ }”) in your query.

5.) Incorrect answer for “Chapter 4: Advanced CRUD Operations Lab 2: Logic Operators”

Solution: Earlier in this course you may have modified some documents in the inspections collection, which is why it is possible to get an incorrect count even if you have written the correct query.

To reset your collections to their initial state we recommend that you delete all the sample data from your Cluster and load a fresh copy of sample data from the menu.


Load sample data to your cluster
Drop all the sample databases in your cluster

6.) What are my Atlas Database-User credentials, where can I find them?

You can manage Atlas Users by clicking on the Database Access link in the sidebar under the security section.

After clicking on the link, you would see an interface like this:

If you don’t have a user with the name as “m001-student” & password as “m001-mongodb-basics’ ’ please create one and replace it within the connection string placeholders whenever you want to connect with your cloud cluster from the shell.

Also, learn more about Atlas vs Database Users.

7.) How to resolve the “uncaught exception: ReferenceError: mongo is not defined”?

Solution: This error usually occurs when you are Running Terminal commands inside the MongoDB shell

To leave the mongo shell type “exit” and press enter/return (or Control + C as a keyboard shortcut), only then can you enter your commands in the terminal/os shell.

8.) How to resolve the “command not found” error?

Solution: These type of errors can occur due to one of the following reasons:

  1. There is a typo in your command, also check whether you are using the correct syntax or not
  2. Running commands before connecting to the cluster which is supposed to be executed through the Mongo shell.

Please use the “mongo” command along with the cluster URL in order to connect to your Atlas cluster, and once you have succeeded, you can proceed after selecting the database you want to work on using the command “use ”

9.) Export/Import/Dump/Restore commands not working on my machine, what’s missing?

Solution: If you are using your own machine instead of the in-browser IDE, then you have to install these tools on your machine.

You can follow the MongoDB installation instructions for your corresponding Operating System:

Once you have installed the tools and have followed all the instructions as mentioned, you are all set to use these commands directly in your Command Prompt/Terminal.

In case you have doubts, please feel free to reach out to us.

Thanks & Regards.
Sourabh Bagrecha,
Curriculum Services Engineer