<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:40 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-383] Aggregate Support</title>
                <link>https://jira.mongodb.org/browse/CSHARP-383</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Is there a version of the C# driver that support the aggregate functionality in the server nightly build? &lt;/p&gt;</description>
                <environment></environment>
        <key id="28511">CSHARP-383</key>
            <summary>Aggregate Support</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="charris">Chris Harris</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Tue, 17 Jan 2012 18:05:20 +0000</created>
                <updated>Fri, 5 Apr 2019 13:57:59 +0000</updated>
                            <resolved>Fri, 27 Jan 2012 15:20:36 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="255566" author="craiggwilson" created="Fri, 1 Feb 2013 11:23:35 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-601&quot; title=&quot;Linq to Aggregation Framework&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-601&quot;&gt;&lt;del&gt;CSHARP-601&lt;/del&gt;&lt;/a&gt; is the tracking for Linq to Aggregation.  It is likely destined for our 2.0 release.&lt;/p&gt;</comment>
                            <comment id="255530" author="hitchhiker" created="Fri, 1 Feb 2013 10:08:24 +0000"  >&lt;p&gt;Is there any time-frame or work in progress for this yet?&lt;/p&gt;</comment>
                            <comment id="173220" author="mikaelkoskinen" created="Wed, 10 Oct 2012 07:00:35 +0000"  >&lt;p&gt;&lt;a href=&quot;http://mikaelkoskinen.net/post/mongodb-aggregation-framework-examples-c-csharp.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Here&apos;s a tutorial&lt;/a&gt; which shows examples of using the MongoDB Aggregation Framework with C#. &lt;/p&gt;</comment>
                            <comment id="106145" author="eddwo" created="Tue, 3 Apr 2012 18:28:22 +0000"  >&lt;p&gt;Wow, that was quick. &lt;br/&gt;
I did a bit of an experiment to see compare the methods.&lt;/p&gt;

&lt;p&gt;If Linq worked with the aggregate framework&lt;/p&gt;

&lt;p&gt;            var collection = db.GetCollection&amp;lt;AdministrativeArea&amp;gt;(&quot;AdminAreas&quot;);&lt;br/&gt;
            var query = from aa in collection.AsQueryable&amp;lt;AdministrativeArea&amp;gt;()&lt;br/&gt;
                        where aa.Districts.Any()&lt;br/&gt;
                        from district in aa.Districts&lt;br/&gt;
                        where district.Name.StartsWith(&quot;L&quot;)&lt;br/&gt;
                        select district;&lt;/p&gt;

&lt;p&gt;(currently throws a NotSupportedException about the &apos;SelectMany()&apos; call)&lt;/p&gt;

&lt;p&gt;vs the long way around using an explicit command.&lt;/p&gt;

&lt;p&gt;            var command = new CommandDocument&lt;br/&gt;
            {&lt;br/&gt;
              &lt;/p&gt;
{ &quot;aggregate&quot;, &quot;AdminAreas&quot; }
&lt;p&gt;,&lt;br/&gt;
              { &quot;pipeline&quot;, new BsonArray{&lt;br/&gt;
                    new BsonDocument{&lt;br/&gt;
                        {&quot;$match&quot;, new BsonDocument{ {&quot;Districts&quot;, new BsonDocument{ &lt;/p&gt;
{&quot;$exists&quot;,true}
&lt;p&gt;}}}}&lt;br/&gt;
                    },&lt;br/&gt;
                    new BsonDocument{&lt;br/&gt;
                        {&quot;$project&quot;, new BsonDocument{ &lt;/p&gt;
{&quot;row&quot;, &quot;$Districts&quot; }
&lt;p&gt; } }&lt;br/&gt;
                    },&lt;br/&gt;
                    new BsonDocument{&lt;/p&gt;
                        {&quot;$unwind&quot;, &quot;$row&quot; }
&lt;p&gt;                    },&lt;br/&gt;
                    new BsonDocument{&lt;br/&gt;
                        {&quot;$match&quot;, new BsonDocument{ &lt;/p&gt;
{&quot;row.Name&quot;, new BsonRegularExpression(&quot;^L&quot;) }
&lt;p&gt;}}&lt;br/&gt;
                    },&lt;br/&gt;
              } }&lt;br/&gt;
            };&lt;/p&gt;


&lt;p&gt;var districts = db.RunCommandAs&amp;lt;AggregateResult&amp;lt;District&amp;gt;&amp;gt;(command).Result;&lt;/p&gt;

&lt;p&gt;with a little helper class to deserialize the unwound districts.&lt;/p&gt;

&lt;p&gt;        class AggregateResult&amp;lt;T&amp;gt; : CommandResult&lt;br/&gt;
        {&lt;br/&gt;
            public IEnumerable&amp;lt;T&amp;gt; Result &lt;br/&gt;
            {&lt;br/&gt;
                get &lt;/p&gt;
{
                    var resultArray = this.Response[&quot;result&quot;].AsBsonArray.Select(row =&amp;gt; row.AsBsonDocument);
                    var rows = resultArray.Select(item =&amp;gt; item[&quot;row&quot;].AsBsonDocument);
                    var objects = rows.Select(row =&amp;gt; BsonSerializer.Deserialize&amp;lt;T&amp;gt;(row));
                    return objects;
                }
&lt;p&gt;            }&lt;br/&gt;
        }&lt;/p&gt;

&lt;p&gt;presuming the field is renamed to &apos;row&apos;.&lt;/p&gt;


</comment>
                            <comment id="106099" author="rstam" created="Tue, 3 Apr 2012 16:40:19 +0000"  >&lt;p&gt;The LINQ implementation in the 1.4 version of the C# driver does not use the aggregation framework.&lt;/p&gt;

&lt;p&gt;We also have realized that some LINQ queries would map well to aggregation framework pipelines, and we plan to research doing that and hope to have it in a future release.&lt;/p&gt;</comment>
                            <comment id="106089" author="eddwo" created="Tue, 3 Apr 2012 16:17:59 +0000"  >&lt;p&gt;Seems like the features of the Aggregation framework would map very nicely onto the standard&lt;br/&gt;
Linq operators. &lt;/p&gt;

&lt;p&gt;$project =&amp;gt; Select()&lt;br/&gt;
$limit =&amp;gt; Take()&lt;br/&gt;
$group =&amp;gt; GroupBy()&lt;br/&gt;
$sort =&amp;gt; OrderBy(),OrderByDescending()&lt;br/&gt;
$unwind =&amp;gt; SelectMany()&lt;br/&gt;
$skip =&amp;gt; Skip()&lt;br/&gt;
$match =&amp;gt; Where()&lt;/p&gt;

&lt;p&gt;And Linq is ideally suited to building up a pipeline of operations&lt;br/&gt;
to submit to the server as a single command.&lt;/p&gt;

&lt;p&gt;Does the new Linq capable version of the CSharp driver go as far &lt;br/&gt;
converting the expression tree into an aggregation pipeline or does&lt;br/&gt;
it only translate Linq expressions into the standard find() query builder &lt;br/&gt;
and cursor options?&lt;/p&gt;

&lt;p&gt;I&apos;ll admit its probably pretty tricky getting it to work with &lt;br/&gt;
arbitrary Linq expressions with &apos;let&apos; bindings etc. &lt;/p&gt;

&lt;p&gt;You&apos;d also have to automatically extract the returned structure&lt;br/&gt;
from the &apos;result&apos; array as an IEnumerable of projected values,&lt;br/&gt;
but that part seems pretty straight forward.&lt;/p&gt;

&lt;p&gt;Seems like an interesting thing to attempt anyway.&lt;/p&gt;</comment>
                            <comment id="80474" author="rstam" created="Tue, 17 Jan 2012 18:13:12 +0000"  >&lt;p&gt;If by aggregate functionality you mean the new aggregation framework then keep in mind that any driver can run any command (whether it has a helper method or not) by building the command object and running it. Since the aggregation framework is command based it is simply a matter of building up the corresponding command and running it.&lt;/p&gt;

&lt;p&gt;So for example:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var command = new CommandDocument&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;{&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    { &quot;aggregate&quot;, &quot;article&quot; },&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    { &quot;pipeline&quot;, new BsonArray&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        { new BsonDocument { &quot;$unwind&quot;, &quot;tags&quot; } }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;};&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var result = database.RunCommand(command);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh4hb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>13523</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>