Python Forum

Full Version: MongoDB cannot connect - pymongo
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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]
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?