[英]ServerTimeoutError with MongoDB Atlas using PyMongo (running setup code)
I'm running the starter code from MongoDB trying to connect to a cluster I just setup in MongoDB Atlas. 我正在从MongoDB运行启动程序代码,尝试连接到刚在MongoDB Atlas中设置的集群。 I'm getting a Server Selection Timeout Error. 我收到服务器选择超时错误。
I haven't been able to find anything in the MongoDB troubleshooting docs about this issue. 我无法在MongoDB故障排除文档中找到有关此问题的任何内容。
client = pymongo.MongoClient(
"mongodb+srv://USR:PWD@cluster0-eoik8.mongodb.net/test?retryWrites=true&w=majority")
db = client.admin
pprint(db.command("serverStatus"))
I've properly encoded the URL (using an online URL encoding service). 我已经正确编码了URL(使用在线URL编码服务)。
The error is 错误是
pymongo.errors.ServerSelectionTimeoutError: connection closed,connection closed,connection closed
它不起作用的原因是因为我没有将我的IP地址列入白名单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.