I need to see list of connections to MongodDB. I know how to do it in mongo console:
> db.currentOp(true)
Now I want to do the same using pymongo. I tried following and it didn't work:
from pymongo import MongoClient
client = MongoClient(host="myhost.com")
db = client.mydb
After that I used db.command() in various combinations trying to pass "db.currentOp(true)" to it without success.
How to do it properly? The question is how to run a command using pymongo if I know how to run it from db console? Is there a common approach?