title: How to intercept and log mongodb queries?
body: <p>How do I get the exact query sent from <code>gmongo</code> driver to <code>mongod</code> (for debugging purposes). </p>
  
  <p>In <strong><em>mysql</em></strong> it is achieved by adding <code>logSql = true</code> to datasource. </p>
  
  <p>I am writing an aggregate query with a matching pipeline between a start and end date. The dates are given as normal java Date classes.</p>
  
  <pre><code>db.collection.aggregate(
              [
                  $match:
                      [
                          dateIssued: [
  
                              $gte: fromDate,
  
                              $lte: toDate
                          ]
                      ]
              ], 
              [
                  $group:
                      [
                          _id: "\$type", 
                          total: 
                              [
                                  $sum: 1
                              ]
                      ]
              ])
  </code></pre>
  
  <p>And it doesn't seem to filter the results based on the date. It's giving me back everything.</p>