Chapter 1 : cannot connect

Hi Steve,

Thanks for pointing that out. I was having difficulties when I first tried to connect to Atlas from computer and adding my project name seemed to work. I figured that the project name was the name of a database and that it was required in the connection string.

I just removed the database portion of the connection string and was still able to connect to Atlas.

mongo "mongodb+srv://<cluster>.mongodb.net" --username <username> --password <password>

HI I am doing chapter 1 for the first time and I tried the following connection string mongo “mongodb+srv://sandbox.svssc.mongodb.net” --username m001-student –password but still get the FAIL errors. Now run out of ideas. Any help appreciated.

Same as already mentioned in this thread.

and

Most likely

  1. you did not enter the command in the appropriate area
    or
  2. you did not press the [ENTER] key at the end of the command.
1 Like

mongo “mongodb+srv://Sandbox.svssc.mongodb.net” --usernamem001-student --password

Sorry, but it is the third and last chance.

Cannot help without.

My apologies, my print screen is not working.

No password specified in the following:

Missing space between the option –username and the value m001-student, still no password specified in the following:

On a seperate note I am doing chapter 4 lab 2 and enter the code db.trips.find({“pop”:1998}).count() and I get the message 1 total, 1 passed, 0 skipped [PASS] “you pressed run test”. How do I get the count to show?

Pressing “Enter” runs the query. Doh!

So it was point number 2 after all.

Yes I am trying the code using the enter key but still having issues. db.trips.find({ “tripduration”: { “$lte” : 70 }}) I get Bash syntax error near unexpected token ‘{’. I cannot see the problem. Any suggestions?

You have to enter the command into the mongo shell. So you have to connect to your cluster first.

Connected to cluster. Thanks.

Hi everybody,
Looks like the issue is resolved, but just to summarize and making it easier for the other community members:

  • Press enter after pasting the command and then run the tests.
  • Paste the connection string in the IDE & NOT in the file editing section (this is one the most common mistakes that learners make).
  • Very unlikely (but possible), if your tests are still failing, try to connect to the cluster locally by installing MongoDB and mongo shell in your machine and if it works please report a bug for the non-working of IDE.

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

Thanks. Regards.
Sourabh Bagrecha,
Curriculum Services Engineer.

3 Likes