I am using this string -mongo “mongodb+srv://cluster0-hzjcd.mongodb.net/test” --username m001-student- along with password but it is connecting me to test data base and when i am using use video and show collections ,wrong collections are being shown.Please, see screeshot
The command mongo is not a command of the mongo shell but a shell command to start the mongo shell. So you have to be at the windows prompt to do it. You are still connected to the previous cluster as the command generated the a SyntaxError.
Hi, previously i have used the same string to connect and it got connected but now, i am facing this syntax error as you mentioned. Then where am i wrong?
I already wrote what you have to do:
Sorry if it is not clear enough. To go back to the windows prompt from the mongo shell please use the command https://docs.mongodb.com/manual/reference/method/quit/.
Yes,i did the same. But when i ran that string, I got the same syntax error.
Please double check from where you are running the srv string
Steve asked you to exit mongo and run the command at Windows cmd prompt or Unix prompt
Paste the latest screen shot where you are getting the error(not the old one you pasted above)
MongoDB Enterprise Cluster-0-shard-0:PRIMARY>
This prompt means that you are already connected to a mongodb cluster and hence you are inside the mongo shell.
If you want to connect to any other mongodb instance then please use the exit command to exit out of the mongo shell.
After running this command paste the connection string into your command prompt and you should be good to go from here.
However, if the issue still persists then please share a screenshot of the commands that you are running.
Curriculum Support Engineer
thanks, a lot for solution