Mongodb group aggregation using ProjectionDefinition with c# driver
<p>I am trying to use the 2.2 version of the driver to create an aggregation query using the FilterDefintion for match phase and ProjectionDefinition for group phase.  But I'm not quite sure how to create a ProjectionDefinition.  The API is like:</p>

<pre><code> FilterDefinition&lt;T&gt; filter=Builders&lt;T&gt;.Filter.Eq("Foo","Bar");
 ProjectionDefinition&lt;T&gt; projection=...
 IAggregateFluent&lt;T&gt; aggr = fileCol.Aggregate&lt;T&gt;()
            .Match(filter)
            .Group(projection);
</code></pre>

<p>The match filter works just like in a normal Find.  But I'm not sure how to create the projection.</p>

<p>I can create just a normal Bson document and put it in that phase, and it works.  But I'm trying to create a consistent interface using the strongly-typed objects that come from builders, and this is the one place where I can't figure out how to do that.  I would think it is possible since the API exists.</p>

<p>(The Bson document for the group phase can be made like):</p>

<pre><code>projection = new BsonDocument("_id","$SomeIdField").
    Add("Result",new BsonDocument("$max","$someNumberField"));
</code></pre>

<p>EDIT:
The MongoDB API I am referring to is linked below, and I quoted the relevant section. There are no examples provided.   I agree that a 'GroupDefinition' would have made more sense, but I didn't write it :-)  And by strongly typed, I mean typed with the return value of whatever  is, not BsonDocument.</p>

<p><a href="http://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_AggregateFluentBase_1_Group__1.htm" rel="noreferrer">http://api.mongodb.com/csharp/current/html/M_MongoDB_Driver_AggregateFluentBase_1_Group__1.htm</a></p>

<blockquote>
  <p>Blockquote</p>
</blockquote>

<pre><code>public abstract IAggregateFluent&lt;TNewResult&gt; Group&lt;TNewResult&gt;(
    ProjectionDefinition&lt;TResult, TNewResult&gt; group
</code></pre>

<p>)</p>

<p><strong>Parameters</strong></p>

<p><em>group</em>
  Type: MongoDB.Driver.ProjectionDefinition&lt;<em>TResult, TNewResult</em>></p>

<p>The group projection.</p>

<p><strong>Type Parameters</strong></p>

<p><em>TNewResult</em></p>

<p>The type of the result of the stage.</p>

<blockquote>
  <p>Blockquote</p>
</blockquote>