<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:26 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-1384] IAggregateFluent&lt;T&gt; ignores BsonElement attribute</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1384</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;When you create an aggregation using the fluent api, it seems that the BsonElement attribute on an element property is ignored.&lt;/p&gt;

&lt;p&gt;See the following fluent aggregation:&lt;/p&gt;

&lt;p&gt;var aggregation = Collection.Aggregate()&lt;br/&gt;
    .Group(key =&amp;gt; new Key&lt;br/&gt;
    &lt;/p&gt;
{
        Name = key.Name,
    }
&lt;p&gt;,&lt;br/&gt;
        g =&amp;gt; new Root&lt;br/&gt;
        &lt;/p&gt;
{
            Id = g.Key,
        }
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;This generates the following aggregation command:&lt;/p&gt;

&lt;p&gt;aggregate([{ &quot;$group&quot; : { &quot;_id&quot; : &lt;/p&gt;
{ &quot;Name&quot; : &quot;$name&quot; }
&lt;p&gt; } }])&lt;/p&gt;

&lt;p&gt;Note the capital &quot;N&quot; on &quot;Name&quot;.&lt;/p&gt;

&lt;p&gt;I&apos;m grouping on a class of the Key, and here&apos;s the code for that class.&lt;/p&gt;

&lt;p&gt;public class Key&lt;br/&gt;
{&lt;br/&gt;
    &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonElement(&amp;quot;name&amp;quot;)&amp;#93;&lt;/span&gt;&lt;br/&gt;
    public string Name &lt;/p&gt;
{ get; set; }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;I&apos;m clearly mentioning &quot;name&quot; here, without any capital.&lt;br/&gt;
The generated aggregation should therefore be:&lt;/p&gt;

&lt;p&gt;aggregate([{ &quot;$group&quot; : { &quot;_id&quot; : &lt;/p&gt;
{ &quot;name&quot; : &quot;$name&quot; }
&lt;p&gt; } }])&lt;/p&gt;

&lt;p&gt;A fix is required because for best practice, field names should not be long (because they are repeated over every document in the collection).&lt;br/&gt;
But POCO classes in C# might have long a descriptive names.&lt;/p&gt;

&lt;p&gt;A field in C# can be named &quot;ArticleNumber&quot;, while in mongo I would like to name it &quot;artNr&quot;.&lt;/p&gt;


&lt;p&gt;Kind regards&lt;/p&gt;</description>
                <environment></environment>
        <key id="226565">CSHARP-1384</key>
            <summary>IAggregateFluent&lt;T&gt; ignores BsonElement attribute</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="-1">Unassigned</assignee>
                                    <reporter username="DeepFritz">Kevin De Coninck [X]</reporter>
                        <labels>
                    </labels>
                <created>Fri, 21 Aug 2015 12:23:24 +0000</created>
                <updated>Wed, 13 Apr 2016 21:04:02 +0000</updated>
                            <resolved>Tue, 5 Apr 2016 00:06:39 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1214383" author="craiggwilson" created="Thu, 24 Mar 2016 20:25:32 +0000"  >&lt;p&gt;Hi Kevin,&lt;/p&gt;

&lt;p&gt;Sorry for the late reply. We are ignoring these on purpose because (a) these names are completely temporary in the context of a query; no data is persisted and (b) we need to ignore them particulary related to type information since these are projected types.&lt;/p&gt;

&lt;p&gt;Is this causing a problem for you? We could certainly opt-in to supporting just BsonElement for naming, but that seems like it doesn&apos;t really do anything except make your queries look different. No functionality is lost or enabled here.&lt;/p&gt;

&lt;p&gt;Craig&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|hscnwf:</customfieldvalue>

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