Aggregation connection to course cluster from PyMongo (Python)

Hello,

Im really looking forward to this course, but I would rather connect via PyMongo, are you able to provide me with the SRV version of the course materials connection string:

mongosh "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/aggregations?replicaSet=Cluster0-shard-0" --authenticationDatabase admin --tls -u m121 -p aggregations

im also happy to connect via Compass but I get these errors:

Thanks in advance!

All the best, Chris

The correct format for the connection string is

mongodb://m121:aggregations@cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/aggregations?replicaSet=Cluster0-shard-0&authSource=admin&tls=true

The above should work for both Compass and python. No need for an SRV record.

The above is just a warning that goes away once you add the tls=true to the connection string. Note that all connections to Atlas require tls=true in the connection string. Using an SRV record automatically sets this even if you don’t add it.

2 Likes

Awesome, thanks doug. got it up and running in python :slight_smile:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.