<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:10:55 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-6166] consider expanding to wider data type on math overflow</title>
                <link>https://jira.mongodb.org/browse/SERVER-6166</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Observed behavior: The result of multiplying two 32 bit integers is a 32 bit integer, even if there is an overflow.&lt;br/&gt;
Proposed behavior: Rather than overflow, an alternative numeric type will be used to store the result when possible.&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;c = db.c;&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;c.drop();&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;&amp;nbsp;&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;c.save( {} );&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;assert.eq( NumberLong( &apos;4611686018427390000&apos; ),&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;           // Current behavior on overflow is for the multiplication result to be zero.&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;           c.aggregate( { $project:{ a:{ $multiply:[ NumberInt( &apos;2147483648&apos; ), NumberInt( &apos;2147483648&apos; )\&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; ] } } } ).result[ 0 ].a );&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Consider addition and subtraction overflow as well.  For numeric addition and subtraction, adding two 32 bit ints will produce a 32 bit int.  Currently division is implemented to always return a double.&lt;/p&gt;

&lt;p&gt;Also consider for accumulators like $sum.&lt;/p&gt;</description>
                <environment></environment>
        <key id="42052">SERVER-6166</key>
            <summary>consider expanding to wider data type on math overflow</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="matt.dannenberg">Matt Dannenberg</assignee>
                                    <reporter username="aaron">Aaron Staple</reporter>
                        <labels>
                    </labels>
                <created>Thu, 21 Jun 2012 19:54:42 +0000</created>
                <updated>Wed, 28 Oct 2015 04:26:23 +0000</updated>
                            <resolved>Fri, 27 Jul 2012 19:57:40 +0000</resolved>
                                                    <fixVersion>2.2.0-rc1</fixVersion>
                                    <component>Aggregation Framework</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="148264" author="auto" created="Fri, 27 Jul 2012 19:52:49 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-07-26T07:29:12-07:00&apos;, u&apos;email&apos;: u&apos;dannenberg.matt@gmail.com&apos;, u&apos;name&apos;: u&apos;Matt Dannenberg&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6166&quot; title=&quot;consider expanding to wider data type on math overflow&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6166&quot;&gt;&lt;del&gt;SERVER-6166&lt;/del&gt;&lt;/a&gt; cast from int to long on overflow agg&lt;/p&gt;

&lt;p&gt;this was started in the past couple commits, but this covers the final couple cases&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/b5a215f3602ff054025732d082453bd503757792&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/b5a215f3602ff054025732d082453bd503757792&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="148262" author="auto" created="Fri, 27 Jul 2012 19:52:46 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-07-23T14:27:55-07:00&apos;, u&apos;email&apos;: u&apos;dannenberg.matt@gmail.com&apos;, u&apos;name&apos;: u&apos;Matt Dannenberg&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6275&quot; title=&quot;$avg assume 0 for undefined&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6275&quot;&gt;&lt;del&gt;SERVER-6275&lt;/del&gt;&lt;/a&gt; &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6197&quot; title=&quot;$avg is calculated using integer math for integers even though result value is of type double&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6197&quot;&gt;&lt;del&gt;SERVER-6197&lt;/del&gt;&lt;/a&gt; use double for $avg&lt;/p&gt;

&lt;p&gt;also do not count non-numeric types in $avg&lt;br/&gt;
also part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6166&quot; title=&quot;consider expanding to wider data type on math overflow&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6166&quot;&gt;&lt;del&gt;SERVER-6166&lt;/del&gt;&lt;/a&gt; up convert from int to long on $sum&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/186c5a411c3a1e616f7e876820a13af46d6faa4c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/186c5a411c3a1e616f7e876820a13af46d6faa4c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="148258" author="auto" created="Fri, 27 Jul 2012 19:52:41 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-07-24T06:59:40-07:00&apos;, u&apos;email&apos;: u&apos;dannenberg.matt@gmail.com&apos;, u&apos;name&apos;: u&apos;Matt Dannenberg&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6570&quot; title=&quot;disallow $add with strings&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6570&quot;&gt;&lt;del&gt;SERVER-6570&lt;/del&gt;&lt;/a&gt; disallow strings in $add in aggro&lt;/p&gt;

&lt;p&gt;also started &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6166&quot; title=&quot;consider expanding to wider data type on math overflow&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6166&quot;&gt;&lt;del&gt;SERVER-6166&lt;/del&gt;&lt;/a&gt; (ints overflowing to long in math) by doing the add portion&lt;br/&gt;
redo testall.js p20 when &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6195&quot; title=&quot;consider $concat to concatenate strings instead of overloading $add&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6195&quot;&gt;&lt;del&gt;SERVER-6195&lt;/del&gt;&lt;/a&gt; is done&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/d3b12c40a91d20dc5b86e40402308c7b2320f9a5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/d3b12c40a91d20dc5b86e40402308c7b2320f9a5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="145560" author="redbeard0531" created="Fri, 20 Jul 2012 21:45:28 +0000"  >&lt;p&gt;I&apos;m going to use roughly the same rules as $inc updates. If anything is a double output is double. If mix of int and long, output is long. If only int, output is int unless it would overflow, else promote to long.&lt;/p&gt;

&lt;p&gt;In addition to $sum, this also effects $avg, which absolutely should never overflow since it can lead to misleadingly low results and is always output as a double anyway.&lt;/p&gt;</comment>
                            <comment id="145333" author="schwerin" created="Fri, 20 Jul 2012 15:17:39 +0000"  >&lt;p&gt;Would it be better to let users coerce input types to govern output types?&lt;/p&gt;</comment>
                            <comment id="145331" author="schwerin" created="Fri, 20 Jul 2012 15:16:54 +0000"  >&lt;p&gt;What is your spec for this?  If a user wishes to observe overflow rather than type widening, how will the user express that? &lt;/p&gt;</comment>
                            <comment id="144950" author="redbeard0531" created="Thu, 19 Jul 2012 17:16:49 +0000"  >&lt;p&gt;moving to 2.2-rc1 since this is really easy to fix&lt;/p&gt;</comment>
                            <comment id="135943" author="schwerin" created="Sat, 23 Jun 2012 01:31:33 +0000"  >&lt;p&gt;The thing about punting this to 2.3.0 is that I&apos;m concerned that someone will come to depend on the overflow behavior, and we&apos;ll be stuck with it.  If we get around to allowing aggregation pipelines to output into collections, we&apos;ll probably have to support operators to coerce types.&lt;/p&gt;</comment>
                            <comment id="135482" author="aaron" created="Thu, 21 Jun 2012 20:12:27 +0000"  >&lt;p&gt;That sounds good to me.  I tried to make the initial description pretty general and don&apos;t have strong opinions on the specifics.&lt;/p&gt;</comment>
                            <comment id="135473" author="schwerin" created="Thu, 21 Jun 2012 19:58:12 +0000"  >&lt;p&gt;I&apos;d be amenable to widening to 64-bit integer, but generally opposed to widening to precision-losing double.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="44719">SERVER-6510</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="42294">SERVER-6203</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="42244">SERVER-6197</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="32452">SERVER-5239</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>10.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 21 Jun 2012 19:58:12 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 29 weeks, 5 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>dan@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 29 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>aaron</customfieldvalue>
            <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>mathias@mongodb.com</customfieldvalue>
            <customfieldvalue>matt.dannenberg</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrnz5z:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrgb7r:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8726</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_10166" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Tests Written</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10154"><![CDATA[Complete]]></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|hrjdo7:</customfieldvalue>

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