Python Forum
MongoDB cannot connect - pymongo - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: MongoDB cannot connect - pymongo (/thread-34690.html)



MongoDB cannot connect - pymongo - speedev - Aug-21-2021

When I try to connect to MongoDB, I can't connect. It says the machine on the other end refused the connection.

import pymongo

baglanti = pymongo.MongoClient("mongodb+srv://newuser:[email protected]/Denemeler?retryWrites=true&w=majority")
db = baglanti["Denemeler"]

koleksiyon = db["Borc"]

koleksiyon.insert({"kullaniciadi": kullanici_adi, "sifre": sifre_giris})
What is problem? How can i solve?
[attachment=1232]


RE: MongoDB cannot connect - pymongo - ndc85430 - Aug-21-2021

It's impossible for us to say really. Have you checked the URI you're passing on line 3? Are all the details in it correct? I suppose it's using the default Mongo port. Are you sure that that's what the server is listening on?