Final exam question 3: default SSL mongoClient setting

answering to the question

Suppose an instance of MongoClient is created with the default settings :

from pymongo import MongoClient uri = “mongodb+srv://” mc = MongoClient(uri) mc.stats

What will be the output of mc.stats?

My answer was

Database(MongoClient(host=['', '', ''], document_class=dict, tz_aware=False, connect=True, authsource='admin', replicaset='m220-lessons-shard-0', **ssl=False**), 'stats')

with ssl=False.

I based my answer on this bit of the documentation at this URL

SSL configuration:

  • ssl: If True , create the connection to the server using SSL. Defaults to False .

Did I misinterpreted something? As the answer marked as correct, is said to have ssl=true.

True but, for Atlas clusters SSL is the default and is mandatory.

1 Like

The question does not specify “instance of MongoClient for an Atlas cluster”.

Because we used an SRV string, SSL is enabled by default for this connection.