title: Passing mongo aggregation to python
body: <p>I have the following piece of code in python which is trying to pass a <code>mongo</code> query. Details of the connection are below. When I execute this, I get "invalid syntax" and the syntax error points right after the code <code>"total:{"...</code> I think this has something to do with dictionary objects in Python but I am a little confused how to proceed. </p>
  
  <pre><code>import pymongo
  
  from pymongo import MongoClient
  
  client = MongoClient()
  
  db = client.trackers
  
  a = list((db.monthlytracker.aggregate([{$match:   
            {'Country':'Japan','Vendor':'Others'}}, 
            {$group:{_id:"$Fiscal Quarter",total:{$sum:"$Units"}}}])))
  </code></pre>