pymongo连接带用户名密码认证的MongoDB

import pymongo
conn = pymongo.MongoClient('mongodb://root:pass@localhost:27017/')
db = conn['database']
coll = db['collection']

官方链接: https://docs.mongodb.com/manual/reference/connection-string/

Post Comment