pull/890/head
dami 2 weeks ago
parent b1f9c99eb1
commit a935acbc95
  1. 10
      plugins/mongodb/index.py
  2. 5
      plugins/mongodb/scripts/backup.py

@ -196,10 +196,11 @@ def mongdbClientS():
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
if auth == 'disabled':
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
client = pymongo.MongoClient(host=ip, port=int(port))
else:
# print(auth,mg_root)
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
# 使用 admin 数据库进行认证,兼容 MongoDB 3.0
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
return client
def mongdbClient():
@ -210,11 +211,12 @@ def mongdbClient():
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
# print(ip,port,auth,mg_root)
if auth == 'disabled':
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
client = pymongo.MongoClient(host=ip, port=int(port))
else:
# uri = "mongodb://root:"+mg_root+"@127.0.0.1:"+str(port)
# client = pymongo.MongoClient(uri)
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
# 使用 admin 数据库进行认证,兼容 MongoDB 3.0
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
return client

@ -122,11 +122,12 @@ def mongdbClient():
mg_root = pSqliteDb('config').where('id=?', (1,)).getField('mg_root')
# print(ip,port,auth,mg_root)
if auth == 'disabled':
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True)
client = pymongo.MongoClient(host=ip, port=int(port))
else:
# uri = "mongodb://root:"+mg_root+"@127.0.0.1:"+str(port)
# client = pymongo.MongoClient(uri)
client = pymongo.MongoClient(host=ip, port=int(port), directConnection=True, username='root',password=mg_root)
# 使用 admin 数据库进行认证,兼容 MongoDB 3.0
client = pymongo.MongoClient(host=ip, port=int(port), username='root', password=mg_root, authSource='admin')
return client
class backupTools:

Loading…
Cancel
Save