title: How to run MongoDB commands with pymongo?
body: <p>I need to see list of connections to MongodDB. I know how to do it in mongo console:</p>
  
  <pre><code>&gt; db.currentOp(true)
  </code></pre>
  
  <p>Now I want to do the same using pymongo. I tried following and it didn't work:</p>
  
  <pre><code>from pymongo import MongoClient
  client = MongoClient(host="myhost.com")
  db = client.mydb
  </code></pre>
  
  <p>After that I used <code>db.command()</code> in various combinations trying to pass <code>"db.currentOp(true)"</code> to it without success.</p>
  
  <p>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?</p>