Windows CMD connection and Mongo Shell Connection

I looked at closed topic ‘Cannott connect with shell’, but this is somewhat different. I followed the video and transcript notes for verifying system environment variables and setting the path. Upon opening the mongo shell and pasting the following string into mongo shell:

`mongo "mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/100YWeatherSmall?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics`

i received this output which was referenced in the transcipt and instructed me to to close/quit mongo shell and run command from windows cmd and I was able to carry out the remainder of the simple cli instructions such as show collections, use db.video and use db.movies.find().pretty(). I subsequently opened mongo shell and tried pasting the above connection string and still received the error listed below. Curious if this is an error or something that needs to be remedied so I can use the mongo shell properly. Thank you in advance.

`MongoDB shell version v4.2.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("96949a30-6807-4cd5-b125-65af1645511c") }
MongoDB server version: 4.2.1
Server has startup warnings:
2020-02-13T22:38:39.848-0500 I  CONTROL  [initandlisten]
2020-02-13T22:38:39.848-0500 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-02-13T22:38:39.848-0500 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2020-02-13T22:38:39.848-0500 I  CONTROL  [initandlisten]
---
Free Monitoring URL:
https://cloud.mongodb.com/freemonitoring/cluster/CJC2EANCB7WVDK3P65VBHVTONTSIHRFG
---
>mongo "mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/100YWeatherSmall?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
2020-02-14T09:05:32.715-0500 E  QUERY    [js] uncaught exception: SyntaxError: unexpected token: string literal :
@(shell):1:6
>`

Looks like you are connected to mongo shell
That is why yu are getting syntax error
Please exit/quit and try again from os prompt
It should work

I verified i was not connected via windows cmd, and my compass is closed. this what occured when i reopened mongo shell from icon in taskbar:

MongoDB shell version v4.2.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("47ab20f6-2e7a-43bf-bf2c-563acd510830") }
MongoDB server version: 4.2.1
Server has startup warnings:
2020-02-13T22:38:39.848-0500 I  CONTROL  [initandlisten]
2020-02-13T22:38:39.848-0500 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-02-13T22:38:39.848-0500 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2020-02-13T22:38:39.848-0500 I  CONTROL  [initandlisten]
---
Free Monitoring URL:
https://cloud.mongodb.com/freemonitoring/cluster/CJC2EANCB7WVDK3P65VBHVTONTSIHRFG
---

This what occurred after I re-pasted the link:

> mongo "mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/100YWeatherSmall?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics
2020-02-14T09:36:02.259-0500 E  QUERY    [js] uncaught exception: SyntaxError: unexpected token: string literal :
@(shell):1:6
> db
test
> show collections
> use test
switched to db test
> show collections
>

Hi @Jeremiah_63395,

As @Ramachandra_37567 mentioned, it looks like that you are already inside the mongo shell.

Please close your command prompt --> start it back again --> then paste this connection string at the windows prompt and hit enter.

mongo "mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/test?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --ssl --username m001-student --password m001-mongodb-basics

If the issue still persists then please share a screenshot of the entire screen including the command that you ran and the output that you got.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Hi @Jeremiah_63395,

Congratulations, now you are connected to the class atlas cluster :clap:

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Thank you for your help.

Closing this thread as the issue has been resolved.