<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:38:31 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>[SERVER-56162] BsonRepresentation(BsonType.String) can&apos;t support aggregate mongoDB</title>
                <link>https://jira.mongodb.org/browse/SERVER-56162</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Hi&#160;&lt;/p&gt;

&lt;p&gt;I try to use &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonRepresentation(BsonType.String)&amp;#93;&lt;/span&gt;&#160;with&#160;Aggregate()&lt;br/&gt;
but it&apos;s not working, in case I&apos;m disable this , it&apos;s working.&lt;/p&gt;

&lt;p&gt;can you help please?&lt;/p&gt;

&lt;p&gt;thanks,&lt;/p&gt;

&lt;p&gt;Inbar&#160;&lt;br/&gt;
&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1682759">SERVER-56162</key>
            <summary>BsonRepresentation(BsonType.String) can&apos;t support aggregate mongoDB</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="backlog-server-triage">Backlog - Triage Team</assignee>
                                    <reporter username="inbar.kabala@hp.com">Inbar Kabala</reporter>
                        <labels>
                    </labels>
                <created>Mon, 19 Apr 2021 14:21:30 +0000</created>
                <updated>Tue, 6 Dec 2022 01:23:54 +0000</updated>
                            <resolved>Thu, 22 Apr 2021 18:58:13 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="3734010" author="JIRAUSER1257066" created="Thu, 22 Apr 2021 18:58:13 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=inbar.kabala%40hp.com&quot; class=&quot;user-hover&quot; rel=&quot;inbar.kabala@hp.com&quot;&gt;inbar.kabala@hp.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for your report. Please note that the SERVER project is for bugs and feature suggestions for the MongoDB server. As this ticket does not appear to be a bug, I will now close it. If you need further assistance troubleshooting, I encourage you to ask our community by posting on the &lt;a href=&quot;https://community.mongodb.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoDB Developer Community Forums&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Kind regards,&lt;br/&gt;
Edwin&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25137"><![CDATA[Server Triage]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 22 Apr 2021 18:58:13 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 41 weeks, 6 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 41 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-triage</customfieldvalue>
            <customfieldvalue>edwin.zhou@mongodb.com</customfieldvalue>
            <customfieldvalue>inbar.kabala@hp.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hz57lz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hyq6q7:</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>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;using MongoDB.Bson;&lt;br/&gt;
using MongoDB.Bson.Serialization.Attributes;&lt;br/&gt;
using MongoDB.Driver;&lt;br/&gt;
using MongoDB.Driver.Linq;&lt;br/&gt;
using System;&lt;br/&gt;
using System.Linq;&lt;/p&gt;

&lt;p&gt;namespace ConsoleApp3&lt;br/&gt;
{&lt;br/&gt;
 class Program&lt;br/&gt;
 {&lt;br/&gt;
 static void Main(string[] args)&lt;br/&gt;
 &lt;/p&gt;
{
 var dbc = new MongoDbCTX();
 dbc.Samples.InsertOne(new Sample() \{ TID = &quot;1&quot;, UID = &quot;1&quot;, CTX = &quot;11&quot;, STAT = Status.B }
&lt;p&gt;);&lt;br/&gt;
 dbc.Samples.InsertOne(new Sample() { TID = &quot;1&quot;, UID = &quot;2&quot;, CTX = &quot;11&quot;, STAT = Status.B });&lt;br/&gt;
 dbc.Samples.InsertOne(new Sample() { TID = &quot;1&quot;, UID = &quot;3&quot;, CTX = &quot;11&quot;, STAT = Status.C });&lt;br/&gt;
 dbc.Samples.InsertOne(new Sample() { TID = &quot;1&quot;, UID = &quot;4&quot;, CTX = &quot;22&quot;, STAT = Status.B });&lt;br/&gt;
 dbc.Samples.InsertOne(new Sample() { TID = &quot;1&quot;, UID = &quot;5&quot;, CTX = &quot;22&quot;, STAT = Status.C });&lt;/p&gt;


&lt;p&gt; var x = dbc.Samples.Aggregate()&lt;br/&gt;
 .Match(x=&amp;gt;x.TID == &quot;1&quot;)&lt;br/&gt;
 .Group(&lt;br/&gt;
 doc =&amp;gt; doc.CTX,&lt;br/&gt;
 group =&amp;gt; new&lt;/p&gt;
 {
 C = group.Key,
 B = group.Where(x =&amp;gt; x.STAT == Status.B).Count(),
 C = group.Where(x =&amp;gt; x.STAT == Status.C).Count(),
 }
&lt;p&gt; ).ToList();&lt;/p&gt;

&lt;p&gt;}&lt;br/&gt;
 }&lt;br/&gt;
 public class MongoDbCTX&lt;br/&gt;
 {&lt;br/&gt;
 private readonly IMongoClient _mongoDbClient = null;&lt;br/&gt;
 private readonly IMongoDatabase _mongoDb = null;&lt;br/&gt;
 public IMongoCollection&amp;lt;Sample&amp;gt; Samples =&amp;gt; _mongoDb.GetCollection&amp;lt;Sample&amp;gt;(nameof(Samples));&lt;br/&gt;
 public MongoDbCTX()&lt;/p&gt;
 {
 _mongoDbClient = new MongoClient(&quot;mongodb://localhost&quot;);
 _mongoDb = _mongoDbClient.GetDatabase(&quot;test&quot;);
 }
&lt;p&gt; public IAggregateFluent&amp;lt;TDocument&amp;gt; Aggregate&amp;lt;TDocument&amp;gt;() =&amp;gt;&lt;br/&gt;
 _mongoDb.GetCollection&amp;lt;TDocument&amp;gt;(nameof(TDocument)).Aggregate();&lt;/p&gt;

&lt;p&gt;}&lt;br/&gt;
 public class Sample&lt;br/&gt;
 &lt;/p&gt;
{
 [BsonId]
 public string ID =&amp;gt; $&quot;\{TID}
{UID}
&lt;p&gt;{CTX}&quot;;&lt;br/&gt;
 public string UID { get; set; }&lt;br/&gt;
 public string TID { get; set; }&lt;br/&gt;
 public string CTX { get; set; }&lt;br/&gt;
 &lt;span class=&quot;error&quot;&gt;&amp;#91;BsonRepresentation(BsonType.String)&amp;#93;&lt;/span&gt; // if disabled it works&lt;br/&gt;
 public Status STAT { get; set; } = Status.A;&lt;br/&gt;
 }&lt;br/&gt;
 public enum Status&lt;/p&gt;
 {
 A,
 B,
 C,
 }
&lt;p&gt;}&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hz4tv3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>