我正在尝试将我的代码连接到 atlas mongo db,但出现以下错误,这是我的代码:
from pymongo import MongoClient
client = MongoClient("mongodb+srv://username:test@cluster0.yntdf.mongodb.net/test?
retryWrites=true&w=majority")
db = client["test"]
collection = db["test"]
collection.insert_one({"_id":0, "name": "hello", "score": 5})
我得到了错误:
配置错误:DNS 标签为空。
有谁知道如何处理这个错误?我安装了 dnspython 和 pymongo