在mongodb shell" db.serverStatus().connections
"输出类似于:
{
"current" : 43,
"available" : 51157,
"totalCreated" : NumberLong(3988)
}
所以,我关心的是如何通过pymongo获得相同的输出。??
答案 0 :(得分:3)
发布MongoDB command
" serverStatus"获取输出并将其保存到变量:
connections_dict = db.command("serverStatus")["connections"]