<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:23 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>[JAVA-3767] aggregate functions, not do match correctly</title>
                <link>https://jira.mongodb.org/browse/JAVA-3767</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;with this code bellow:&#160;&lt;/p&gt;

&lt;p&gt;mongoTemplate.getCollection(COLLECTION_NAME).aggregate(&lt;br/&gt;
 Arrays.asList(&lt;/p&gt;

&lt;p&gt; Aggregates.match(Filters.eq(&quot;cpfCnpj&quot;,cpfCnpj))&lt;br/&gt;
 ,&lt;br/&gt;
 Aggregates.group(&lt;br/&gt;
 new Document()&lt;br/&gt;
 .append(&quot;cpfCnpj&quot;, &quot;$cpfCnpj&quot;)&lt;br/&gt;
 .append(&quot;namPostalArea&quot;, &quot;$namPostalArea&quot;)&lt;br/&gt;
 .append(&quot;namDistrict&quot;, &quot;$namDistrict&quot;)&lt;br/&gt;
 .append(&quot;namFederationUnit&quot;, &quot;$namFederationUnit&quot;)&lt;br/&gt;
 .append(&quot;namCity&quot;, &quot;$namCity&quot;)&lt;br/&gt;
 .append(&quot;quantity&quot;, &quot;$quantity&quot;)&lt;br/&gt;
 )&lt;br/&gt;
 ,&lt;br/&gt;
 Aggregates.group(&lt;br/&gt;
 new Document().append(&quot;cpfCnpj&quot;, &quot;$_id.cpfCnpj&quot;)&lt;br/&gt;
 ,Accumulators.sum(&quot;totalDistinctAddresses&quot;, &quot;$_id.quantity&quot;)&lt;br/&gt;
 )&lt;br/&gt;
 ,&lt;br/&gt;
 Aggregates.project(&lt;br/&gt;
 Projections.fields(&lt;br/&gt;
 Projections.excludeId(),&lt;br/&gt;
 Projections.computed(&quot;cpfCnpj&quot;, &quot;$_id.cpfCnpj&quot;),&lt;br/&gt;
 Projections.include(&quot;totalDistinctAddresses&quot;)&lt;br/&gt;
 )&lt;br/&gt;
 )&lt;br/&gt;
 ,&lt;br/&gt;
 Aggregates.merge(VIEW_NAME, new MergeOptions()&lt;br/&gt;
 .uniqueIdentifier(&quot;cpfCnpj&quot;)&lt;br/&gt;
 .whenNotMatched(MergeOptions.WhenNotMatched.INSERT)&lt;br/&gt;
 .whenMatchedPipeline(&lt;br/&gt;
 Arrays.asList(new Document()&lt;br/&gt;
 .append(&quot;$addFields&quot;, new Document()&lt;br/&gt;
 .append(&quot;totalDistinctAddresses&quot;, new Document(&quot;$add&quot;, Arrays.asList(&quot;$totalDistinctAddresses&quot;, &quot;$$new.totalDistinctAddresses&quot;)))&lt;br/&gt;
 )&lt;br/&gt;
 )&lt;br/&gt;
 )&lt;br/&gt;
 )&lt;br/&gt;
 )&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;if has only one cpfCnpj in the collection,&#160; it is doing aggregation for 113 items of the collection, the final result is correctly, but with match stage and contain only one of the cpf used, should do only one aggregation.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;The driver version is 4.0.3&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;the data used in the log are fake , so not contain sensitive data&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I attached the log event, the first log event is the query used in match stage.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1382249">JAVA-3767</key>
            <summary>aggregate functions, not do match correctly</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="-1">Unassigned</assignee>
                                    <reporter username="rodrigobrito.ciencia@gmail.com">rodrigo brito</reporter>
                        <labels>
                    </labels>
                <created>Wed, 17 Jun 2020 02:30:25 +0000</created>
                <updated>Mon, 29 Jun 2020 14:13:47 +0000</updated>
                            <resolved>Mon, 29 Jun 2020 14:13:47 +0000</resolved>
                                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3228053" author="esha.bhargava" created="Mon, 29 Jun 2020 14:13:22 +0000"  >&lt;p&gt;Hi there, thank you for reaching out. As this sounds like a support issue, I wanted to give you some resources to get this questioned answered more quickly:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;our MongoDB support portal, located at &lt;a href=&quot;https://support.mongodb.com/welcome&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;support.mongodb.com&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;our MongoDB community portal, located &lt;a href=&quot;https://developer.mongodb.com/community/forums/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;br/&gt;
-If you are an Atlas customer, there is free support offered 24/7 in the lower right hand corner of the UI.&lt;br/&gt;
Just in case you have already opened a support case and are not receiving sufficient help, please let me know and I can facilitate escalating your issue.&lt;br/&gt;
Thank you!&lt;/li&gt;
&lt;/ul&gt;
</comment>
                    </comments>
                    <attachments>
                            <attachment id="266149" name="logs.txt" size="25525" author="rodrigobrito.ciencia@gmail.com" created="Wed, 17 Jun 2020 02:28:24 +0000"/>
                    </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|hxd8qf:</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>