参考链接:
http://api.mongodb.com/python/current/examples/authentication.html
mongodb = pymongo.MongoClient(f'mongodb://{username}:{password}@localhost:27017/test', serverSelectionTimeoutMS=3000)
或者
mongodb = pymongo.MongoClient(f'mongodb://localhost:27017/test',
serverSelectionTimeoutMS=3000, username='user', password='1')
注意链接后面加上数据库的名字, 否则没有办法执行插入操作,(删改查我没有试)