pymong提供的MongoDB工作集

2024-06-10 08:45:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试用pymongo获得“工作集”指标。在MongoDB中只是db.runCommand( { serverStatus: 1, workingSet: 1 } )。我试过python

from pymongo.mongo_client import MongoClient
connection = MongoClient('localhost', 27017)
db = connection['admin']
workingSetMetrics = db.command("serverStatus", "workingSet")
print 'workingSetMetrics: ', workingSetMetrics

我的方法行不通。它的输出不是任何“工作集”指标。在

知道如何用python编程获得这些度量吗?在


Tags: fromimportclientlocalhostdbmongomongodbconnection