title: Implementing a mongodb aggregation pipeline in c#
body: <p>I have mongdb 'aggregation query' containing eight steps, that I can run in the console and in RoboMongo successfully.</p>
  
  <pre><code>db.getCollection("...").aggregate([
      {$match: { ... } },
      {$unwind: ... },
      {$project: { ... } },
      {$group: { ... } },
      {$project: { ... } },
      {$unwind: ... },
      {$group: { ... } }
  ])
  </code></pre>
  
  <p>Now is the time to get this thing running inside my asp.net app, but I struggle heavily with the implementation in c#.</p>
  
  <p>The new aggregation framework looks promising, but I don't want to define every intermediate type through the pipeline, and as far as I can see, it doesn't work without it. </p>
  
  <p>So the question is:<br>
  <strong>Is it possible to use the aggregation framework without defining each intermediate type?</strong></p>
  
  <p>and secondly,<br>
  <strong>What would be the best way of implementing existing queries like this?</strong></p>
  
  <p>I see the framework contains multiple ways of defining the aggregation pipeline, like different <code>PipelineDefinition</code> implementations and the extension methods, but I find little documentation and use of these. </p>