使用 pymongo 的 Python MongoDB 最小连接示例
此示例将连接到运行在 localhost(默认端口 27017)上的 MongoDB,不带任何用户名或密码,打开名为 mydb 的数据库
pymongo_minimal_connect.py
from pymongo import MongoClient
client = MongoClient("mongodb://localhost")
db = client["mydb"]If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow