title: How to write mongo shell commands into the equivalent C# statements
body: <p>I am trying to use the aggregate function to get a count of popular tags in a certain collection. I want to simply execute pure MongoDB queries via MongoDb for Windows &amp; .Net(C# 4.0) driver.</p>
  
  <p>Here is the mongo shell query, I wish to execute (see <a href="https://stackoverflow.com/questions/21965585/mongodb-aggregate-how-to-count-documents-by-interval-criteria">Mongodb aggregate, How to count documents by interval criteria?</a>)?</p>
  
  <pre><code>collection.aggregate({
      $group: { "_id": { $cond: [{$gte: ["$LoadTime", 2000]}, "Slowest", 
                                  {$cond: [ {$and: [{$lt: ["$LoadTime", 2000] },{$gte: ["$LoadTime", 1000]}]}, "Slow", 
                                      {$cond: [{$and: [{$lt: ["$LoadTime", 1000]}, {$gte: ["$LoadTime", 500 ]} ]},"Medium","Fast"]}
                                          ]}
                                ]},
                "count": {$sum: 1}   
              }
  })
  </code></pre>
  
  <p>I am not sure how can i do this. 
  Perhaps with call Database.RunCommand("TheCommand") or bson_xxxx methods but I don't know how.
  Is it possible to execute pure MongoDB queries via .Net (C# 4.0) driver?</p>