Can't connect to Atlas cluster created by using Mongo shell

I was able to log in to mongoDBAtlas OK. In the Clusters dropdown I was able to choose M001-BasicCourseOrg (m001). (NOTE:There’s also actually a 2nd cluster which somehow got created called “Margaret r’s Org”( Project 0).

This resulted in a page with a Connect button which looked like the video.

Having clicked Connect, I got a pop-up page which looked nothing like the video. Choices were Connect With Mongo Shell, Connect Application and Connect Using Compass. After clicking “Connect using Mongo Shell” The new pop-up had 3 steps.

1.The first was to select your operating system and then Download Mongo Shell (4.2.3) via link or via Fetching by URL. (Of course I had already done this in the coursework.)

  1. Step 2 was “Add <your Mongo Shell’s download directory>/bin to your $PATH variable.”
    (No idea what this is or how to do it.)

  2. Step 3 was – “Run your connection string in your command line.”
    “You will be prompted for the password for the database user, m001-student. When entering your password, make sure that any special characters are URL encoded.”
    A command line sample was shown and a “Copy” button copied it to the clipboard. That line was –
    mongo “mongodb+srv://sandbox-une7l.mongodb.net/test” --username m001-student

I pasted it into the Mongo Shell and got the error message
2020-03-01T16:50:58.642-0700 E QUERY [js] uncaught exception:SyntaxError: unexpected token: string literal:@(shell)1:6

I tried the line without quotes, also, but it made no difference.

Unlike the video, the “Clusters” page has nothing on it below the very top section with the headings “Cluster Tier, Region, Type, Linked Stictch App”.

I did not get as far as being prompted to enter a password.

The instructions do not bear much resemblance to what I actually see at Atlas.

Please help.

It’s just a problem with the inverted quotes that you used. Use this connection string:

mongo "mongodb+srv://sandbox-une7l.mongodb.net/test" --username m001-student --password m001-mongodb-basics

1 Like

Tried it again but got same error message. By the way, quote marks only become curly when posting in this forum or MS Word, They stay straight when pasted into notepad or into the Mongo Shell.

You need to ensure that you’re copying it properly including the password. I’m able to connect:

Here’s the string I tried this time. (Quotes may turn curly in this message but they were straight in the Mongo Shell.)

mongo “mongodb+srv://sandbox-une7l.mongodb.net/test” --username m001-student --password m001-mongodb-basics

But I got the same error message again.

Share an actual screenshot of the command and the error message.

Looking at your example, it looked like your were using a plain, old command prompt, not the Mongo Shell.

So I went into the command prompt and used that – and it worked!

Also – I didn’t think we were allowed to use screenshots but I will from now on.

Many thanks for the help.

Indeed I was :slight_smile: and yes you can… as long as you’re not showing potential answers to labs :slight_smile:

2 Likes

Closing this thread as the issue has been resolved.