Canot access to shell

mongo “mongodb+srv://sandbox-xxxxx.mongodb.net/admin” --username m001-student --password m001-mongodb-basics
uncaught exception: SyntaxError: unexpected token: string literal :
@(shell):1:6

I have used my clster instead of xxxxx
I am running this from the mongo db shell and not from the cmd, and I am using windows

Why don’t you run it from cmd like the instructions specify?

Commands that should be run in the cmd or powershell must be run from the cmd or powershell and commands that should be run in the mongo shell must be run in the mongo shell.

PS C:\Users\Mini Mariyam> mongo mongodb+srv://sandbox-xxxxx.mongodb.net/test --username m001 student
mongo : The term ‘mongo’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1

  • mongo mongodb+srv://sandbox-o6ljx.mongodb.net/test --username m001 st …
  •   + CategoryInfo          : ObjectNotFound: (mongo:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

Suggestion [3,General]: The command mongo was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: “.\mongo”. See “get-help about_Command_Precedence” for more details.
PS C:\Users\Mini Mariyam>

You either have to set your %PATH% to include the directory where mongo is installed or specify the full or relative path to the command.

Hi @Mini_Mariyam_Varghese,

This :point_down:t2:

The steps for setting the path is provided in the course lecture.

~ Shubham

I’m still new myself but if you go to your terminal and type in
mongo
what happens

If there is a mongod running on default port 27017 it will connect you to mongodb instance
What is your os?
On Windows it runs as service and you can connect just by typing mongo
On Unix systems it may fail with error could not connect to…
You need to start mongod then connect

If you run mongo without any options it tries to connect to default port 27017
If you want to connect to another instance
use mongo --port your_port_number—>for this to work mongod should be up and running on the port you are going to pass in your mongo command

“C:\Program Files\MongoDB\Server\4.4\bin\momgo.exe”
C:\Program Files\MongoDB\Server\4.4\bin\momgo.exe
PS C:\Users\Mini Mariyam> mongo “mongodb+srv://sandbox.o6ljx.mongodb.net/test” --username m001-student
mongo : The term ‘mongo’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1

  • mongo “mongodb+srv://sandbox.o6ljx.mongodb.net/test” --username m001- …
  •   + CategoryInfo          : ObjectNotFound: (mongo:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

Suggestion [3,General]: The command mongo was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: “.\mongo”. See “get-help about_Command_Precedence” for more details.
PS C:\Users\Mini Mariyam> mongo --version
mongo : The term ‘mongo’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1

  • mongo --version
  •   + CategoryInfo          : ObjectNotFound: (mongo:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

Suggestion [3,General]: The command mongo was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: “.\mongo”. See “get-help about_Command_Precedence” for more details.

Do I have to have MongoDB Enterprise version?