<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:31:50 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-32960] $mod has inconsistent rounding/truncation behavior</title>
                <link>https://jira.mongodb.org/browse/SERVER-32960</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;See &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-7792&quot; title=&quot;$mod silently truncates decimal arguments to integers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-7792&quot;&gt;&lt;del&gt;DOCS-7792&lt;/del&gt;&lt;/a&gt; - $mod will truncate a double (e.g. 2.7 -&amp;gt; 2), but will &lt;em&gt;round&lt;/em&gt; decimals, ties to even (e.g. 3.5 -&amp;gt; 4).&lt;/p&gt;

&lt;p&gt;We should be consistent here, probably truncating decimals as well as doubles.&lt;/p&gt;

&lt;p&gt;Also, $mod treats it&apos;s divisor and remainder arguments as int values. This could lead to unexpected behaviour when these arguments are larger than int. For example:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.createCollection(&apos;test&apos;)&lt;br/&gt;
&amp;gt; db.test.insert([&lt;/p&gt;
{a: 4000000000}
&lt;p&gt;])&lt;br/&gt;
&amp;gt; db.test.find({a: {$mod: &lt;span class=&quot;error&quot;&gt;&amp;#91;4000000000, 0&amp;#93;&lt;/span&gt;}})&lt;/p&gt;

&lt;p&gt;The last query should return the single record from the test collection, but returns nothing instead.&lt;/p&gt;

&lt;p&gt;The suggestion is to truncate decimals and doubles consistently towards zero into long long type.&lt;/p&gt;</description>
                <environment></environment>
        <key id="488814">SERVER-32960</key>
            <summary>$mod has inconsistent rounding/truncation behavior</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="13201">Fixed</resolution>
                                        <assignee username="nikita.lapkov@mongodb.com">Nikita Lapkov</assignee>
                                    <reporter username="charlie.swanson@mongodb.com">Charlie Swanson</reporter>
                        <labels>
                            <label>neweng</label>
                            <label>query-44-grooming</label>
                    </labels>
                <created>Mon, 29 Jan 2018 17:31:57 +0000</created>
                <updated>Sun, 29 Oct 2023 22:35:23 +0000</updated>
                            <resolved>Thu, 19 Nov 2020 15:34:25 +0000</resolved>
                                                    <fixVersion>4.9.0</fixVersion>
                    <fixVersion>4.0.22</fixVersion>
                    <fixVersion>3.6.22</fixVersion>
                    <fixVersion>4.4.3</fixVersion>
                    <fixVersion>4.2.12</fixVersion>
                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="3497733" author="xgen-internal-githook" created="Thu, 19 Nov 2020 15:25:06 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Nikita Lapkov&apos;, &apos;email&apos;: &apos;nikita.lapkov@mongodb.com&apos;, &apos;username&apos;: &apos;laplab&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32960&quot; title=&quot;$mod has inconsistent rounding/truncation behavior&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32960&quot;&gt;&lt;del&gt;SERVER-32960&lt;/del&gt;&lt;/a&gt;: Make $mod truncate float values consistently and use long long for its arguments&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/0a2bfde4719880480c442d9fd619546522162b8e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/0a2bfde4719880480c442d9fd619546522162b8e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3497702" author="xgen-internal-githook" created="Thu, 19 Nov 2020 15:12:42 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Nikita Lapkov&apos;, &apos;email&apos;: &apos;nikita.lapkov@mongodb.com&apos;, &apos;username&apos;: &apos;laplab&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32960&quot; title=&quot;$mod has inconsistent rounding/truncation behavior&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32960&quot;&gt;&lt;del&gt;SERVER-32960&lt;/del&gt;&lt;/a&gt; Make $mod truncate float values consistently and use long long for its arguments&lt;br/&gt;
Branch: v4.2&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/6f7f808583de3c432458d0adc2413d3a4022c126&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/6f7f808583de3c432458d0adc2413d3a4022c126&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3497651" author="xgen-internal-githook" created="Thu, 19 Nov 2020 14:56:18 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Nikita Lapkov&apos;, &apos;email&apos;: &apos;nikita.lapkov@mongodb.com&apos;, &apos;username&apos;: &apos;laplab&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32960&quot; title=&quot;$mod has inconsistent rounding/truncation behavior&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32960&quot;&gt;&lt;del&gt;SERVER-32960&lt;/del&gt;&lt;/a&gt; Make $mod truncate float values consistently and use long long for its arguments&lt;br/&gt;
Branch: v4.0&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/af44d6124a35aec82a22693cade942c4f9d2f53a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/af44d6124a35aec82a22693cade942c4f9d2f53a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3497640" author="xgen-internal-githook" created="Thu, 19 Nov 2020 14:51:19 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Nikita Lapkov&apos;, &apos;email&apos;: &apos;nikita.lapkov@mongodb.com&apos;, &apos;username&apos;: &apos;laplab&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32960&quot; title=&quot;$mod has inconsistent rounding/truncation behavior&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32960&quot;&gt;&lt;del&gt;SERVER-32960&lt;/del&gt;&lt;/a&gt; Make $mod truncate float values consistently and use long long for its arguments&lt;br/&gt;
Branch: v4.4&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/841dc94c12b80bafef30b9c189fc59b0ac5a8ff8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/841dc94c12b80bafef30b9c189fc59b0ac5a8ff8&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3497607" author="xgen-internal-githook" created="Thu, 19 Nov 2020 14:40:09 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Nikita Lapkov&apos;, &apos;email&apos;: &apos;nikita.lapkov@mongodb.com&apos;, &apos;username&apos;: &apos;laplab&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32960&quot; title=&quot;$mod has inconsistent rounding/truncation behavior&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32960&quot;&gt;&lt;del&gt;SERVER-32960&lt;/del&gt;&lt;/a&gt; Make $mod truncate float values consistently and use long long for its arguments&lt;br/&gt;
Branch: v3.6&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/9f73260db3bfa261b2f02880bcbf6010cbc10ea6&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/9f73260db3bfa261b2f02880bcbf6010cbc10ea6&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3369700" author="xgen-internal-githook" created="Tue, 1 Sep 2020 12:23:07 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Nikita Lapkov&apos;, &apos;email&apos;: &apos;nikita.lapkov@mongodb.com&apos;, &apos;username&apos;: &apos;laplab&apos;}
&lt;p&gt;Message: Revert &quot;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32960&quot; title=&quot;$mod has inconsistent rounding/truncation behavior&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32960&quot;&gt;&lt;del&gt;SERVER-32960&lt;/del&gt;&lt;/a&gt; Make $mod always truncate divisor and remainder toward zero&quot;&lt;/p&gt;

&lt;p&gt;This reverts commit cb131974041efdcd0b4a99fe3bd316cbb9b4db41.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/fa38abd6d670f9b43dd9771b68f3b1a6441183b0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/fa38abd6d670f9b43dd9771b68f3b1a6441183b0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3367556" author="JIRAUSER1255444" created="Mon, 31 Aug 2020 14:02:53 +0000"  >&lt;p&gt;Will revert commit because of&#160;BF-18654&lt;/p&gt;</comment>
                            <comment id="3362994" author="xgen-internal-githook" created="Thu, 27 Aug 2020 19:55:15 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Nikita Lapkov&apos;, &apos;email&apos;: &apos;nikita.lapkov@mongodb.com&apos;, &apos;username&apos;: &apos;laplab&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32960&quot; title=&quot;$mod has inconsistent rounding/truncation behavior&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32960&quot;&gt;&lt;del&gt;SERVER-32960&lt;/del&gt;&lt;/a&gt; Make $mod always truncate divisor and remainder toward zero&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/cb131974041efdcd0b4a99fe3bd316cbb9b4db41&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/cb131974041efdcd0b4a99fe3bd316cbb9b4db41&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="608311">DRIVERS-874</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10320">
                    <name>Documented</name>
                                                                <inwardlinks description="is documented by">
                                        <issuelink>
            <issuekey id="1455847">DOCS-13855</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="1454327">SERVER-50579</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                            <outwardlinks description="causes">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="488820">SERVER-32961</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="283980">DOCS-7792</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="18953"><![CDATA[v4.4]]></customfieldvalue>
    <customfieldvalue key="16775"><![CDATA[v4.2]]></customfieldvalue>
    <customfieldvalue key="15640"><![CDATA[v4.0]]></customfieldvalue>
    <customfieldvalue key="15141"><![CDATA[v3.6]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10011"><![CDATA[Minor Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 26 Aug 2020 16:10:58 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 11 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_17052" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Downstream Changes Summary</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>$mod now truncates it&amp;#39;s arguments and input values towards zero.&lt;br/&gt;
Before this change $mod truncated them to the nearest integer</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16942"><![CDATA[Needed]]></customfieldvalue>

                        </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>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 11 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>44.0</customfieldvalue>

                        </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>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>nikita.lapkov@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htozpr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr4z73:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="3620">Query 2020-11-30</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_17051" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Teams Impacted</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16943"><![CDATA[Cloud]]></customfieldvalue>
    <customfieldvalue key="16944"><![CDATA[Docs]]></customfieldvalue>
    <customfieldvalue key="16945"><![CDATA[Drivers]]></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|htoluf:</customfieldvalue>

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