10 lines
313 B
Python
10 lines
313 B
Python
'''
|
|
创建MongoDB 用户
|
|
'''
|
|
import pymongo
|
|
client = pymongo.MongoClient("127.0.0.1",27017)
|
|
client["admin"]["system.version"].update_one({"_id" : "authSchema"},{"$set":{"currentVersion":5}})
|
|
client["admin"].command("createUser", "root", pwd="iamciniao", roles=["root"])
|
|
print("Create MongoDB User Success ... ")
|
|
|