gpt4 book ai didi

python - 如何通过python中的pymongo获取db.serverStatus().connections的输出?

转载 作者:可可西里 更新时间:2023-11-01 10:03:18 29 4
gpt4 key购买 nike

在 mongodb shell 中“db.serverStatus().connections”给出的输出类似于:

{ 
"current" : 43,
"available" : 51157,
"totalCreated" : NumberLong(3988)
}

所以,我关心的是如何通过 pymongo 获得相同的输出。??

最佳答案

发布 MongoDB command "serverStatus"获取输出并将其保存到变量中:

connections_dict = db.command("serverStatus")["connections"]

关于python - 如何通过python中的pymongo获取db.serverStatus().connections的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34898723/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com