Getting Started with Python and MongoDB

Hi everyone,

I’m new to MongoDB and programming overall. I’m trying to return information about the MongoDB server by following the guide from this webpage . After running my py. file (below a screenshot attached), I get errors -

mongodb+srv:// - that is my connection string and I wanted to clarify what what password I have to put in. I assume the one that I generated from database user, right?:

For ‘‘dbname’’ name i use ‘dbCars’ a newly created database like shown on the screeshot below

Correct me if I put the wrong data in my connection string and please advise why the code im running doesn’t provide the outcome as from the webpage link…

Appreciate your help much.

You assumed correctly.

It is …/dbCars?retryWrites… rather than …/<dbCars>?retryWrites… .

Since I see <MyPass> in your URI as parameter to MongoClient(…), may be you have the same issue with the < and > as with dbCars.


thanks a lot. this was part of the solution!

Apart from this mistake I used password from my account instead of using a password associated to a user database. I also used for a user database password the same password that I use for my account, which apparently is a bad practise, so I generated a new user database password and finally everything worked…

1 Like

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