Unrecognized option: --SSL

To whom it may concern;

I have a problem with Chapter 2, with this lesson: Connecting to Our Class Atlas Cluster from the mongo Shell. When I try to do it with this string:

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 get an error like this:

Error parsing command line: unrecognised option '--ssl' try 'mongo --help' for more information

And typing mongo --help gives the following:

MongoDB shell version v4.0.3
usage: mongo [options] [db address] [file names (ending in .js)]
db address can be:
  foo                   foo database on local machine
  192.168.0.5/foo       foo database on 192.168.0.5 machine
  192.168.0.5:9999/foo  foo database on 192.168.0.5 machine on port 9999
Options:
  --shell                             run the shell after executing files
  --nodb                              don't connect to mongod on startup - no
                                      'db address' arg expected
  --norc                              will not run the ".mongorc.js" file on
                                      start up
  --quiet                             be less chatty
  --port arg                          port to connect to
  --host arg                          server to connect to
  --eval arg                          evaluate javascript
  -h [ --help ]                       show this usage information
  --version                           show version information
  --verbose                           increase verbosity
  --ipv6                              enable IPv6 support (disabled by default)
  --disableJavaScriptJIT              disable the Javascript Just In Time
                                      compiler
  --enableJavaScriptJIT               enable the Javascript Just In Time
                                      compiler
  --disableJavaScriptProtection       allow automatic JavaScript function
                                      marshalling
  --retryWrites                       automatically retry write operations upon
                                      transient network errors
  --disableImplicitSessions           do not automatically create and use
                                      implicit sessions
  --jsHeapLimitMB arg                 set the js scope's heap size limit

Authentication Options:
  -u [ --username ] arg               username for authentication
  -p [ --password ] arg               password for authentication
  --authenticationDatabase arg        user source (defaults to dbname)
  --authenticationMechanism arg       authentication mechanism
  --gssapiServiceName arg (=mongodb)  Service name to use when authenticating
                                      using GSSAPI/Kerberos
  --gssapiHostName arg                Remote host name to use for purpose of
                                      GSSAPI/Kerberos authentication

file names: a list of files to run. files have to end in .js and will exit after unless --shell is specified

As you can see, there isn’t any –ssl option.

I’m using MongoDB Enterprise on Windows 10 Home.
This is what happens when I type mongo --version

MongoDB shell version v4.0.3
git version: 7ea530946fa7880364d88c8d8b6026bbc9ffa48c
allocator: tcmalloc
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_6

Please help me if you can.
Thank you.

PS: on the documentation, I found this:

STARTING IN VERSION 4.2

  • MongoDB deprecates the SSL options and insteads adds new corresponding TLS options.

Could this be the reason why I couldn’t connect to this database? I actually have the 4.2 version of MongoDB Enterprise.

@Silvia_Gloria_Tamburini_44324 Yes, just replace --ssl with --tls

Your mongo shell version is 4.0.3 so perhaps you have have two different versions running. Suggest you have a look in the PATH variable and point it to 4.2 if you wish.

In 4.2.x you should get a warning message instead of an error.

1 Like

Hi @Silvia_Gloria_Tamburini_44324,

Please run this command and share a screenshot of the output.

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

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Thank you, @007_jb, that was the problem! I have installed Mongo DB Enterprise version 4.2, but for whatever reason, my shell was in version 4.0.3. I don’t know exactly why, because I’ve never installed MongoDB Enterprise before… my hypothesis is that something like this command comes within Anaconda. By the way, I’ve done exactly what you suggested, and now it works! Thank you!

You can check what was installed via Anaconda by using the Anaconda Navigator:


And it appears that the error was fixed and changed to a warning" in newer versions. It will most likely revert to becoming an error in the future. Plus mongo shell 4.0.3 cannot be downloaded from the MongoDB download site so the “error” must have been an unwanted behaviour/bug.