<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:08:13 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-5209] can&apos;t compare values of BSON types 16 and 18 </title>
                <link>https://jira.mongodb.org/browse/SERVER-5209</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When testing the aggregation framework, tried to group by a field that has been previously stored as both 64-bit and 32-bit numbers, depending on the number.&lt;/p&gt;

&lt;p&gt;Running the aggregation query results in a code 16016, or &quot;exception: can&apos;t compare values of BSON types 16 and 18&quot;&lt;/p&gt;

&lt;p&gt;Running the old db.collection.group query still works as intended.&lt;/p&gt;

&lt;p&gt;Heavily simplified versions of the aggregation framework query (not working) and the original collection.group query (working) are attached.  In both of these queries, it is understood that the field &apos;ip1&apos; may contain either a 32-bit number (BSON type 16) or a 64-bit number (type 18)  I would expect both queries to return groupings based on the field &apos;ip1&apos;.&lt;/p&gt;

&lt;p&gt;A probable work-around (implementing this currently) is to somehow ensure that all data is written as a 64-bit number, so that all comparisons are between like types, but this seems like something that a green mongo user might find cumbersome to have to understand and deal with.&lt;/p&gt;

&lt;p&gt;New to the bug-fix cycle, and to mongodb in general-- let me know if there&apos;s more information I can provide.&lt;/p&gt;</description>
                <environment>Debian 5, Kernel 2.6.26, 32-bit OS.</environment>
        <key id="32230">SERVER-5209</key>
            <summary>can&apos;t compare values of BSON types 16 and 18 </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="cwestin">Chris Westin</assignee>
                                    <reporter username="tcgarvin">Tim Garvin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 5 Mar 2012 18:50:12 +0000</created>
                <updated>Thu, 5 Nov 2015 15:51:34 +0000</updated>
                            <resolved>Wed, 7 Mar 2012 01:24:41 +0000</resolved>
                                    <version>2.1.0</version>
                                    <fixVersion>2.1.1</fixVersion>
                                    <component>Aggregation Framework</component>
                    <component>Internal Code</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="96583" author="cwestin" created="Wed, 7 Mar 2012 22:11:49 +0000"  >&lt;p&gt;$sort may also be affected, since the numeric comparisons have been adjusted to work across numeric data types.&lt;/p&gt;</comment>
                            <comment id="96572" author="samk" created="Wed, 7 Mar 2012 21:53:43 +0000"  >&lt;p&gt;does this &lt;b&gt;only&lt;/b&gt; affect the $group operator, or are other pipeline operators similarly impacted?&lt;/p&gt;</comment>
                            <comment id="96470" author="cwestin" created="Wed, 7 Mar 2012 18:08:16 +0000"  >&lt;p&gt;BSON allows the use of several numeric types, not just JavaScript&apos;s&lt;br/&gt;
double precision floating point numbers.  We notate these special numeric&lt;br/&gt;
types as demonstrated by &lt;a href=&quot;https://jira.mongodb.org/browse/MONGOSH-1032&quot; title=&quot;NumberInt object wrapper is not displayed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;MONGOSH-1032&quot;&gt;&lt;del&gt;SERVER-5234&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Aggregation (as well as any other operations that operate over an entire&lt;br/&gt;
collection) works best if the data types of the fields are homogeneous.  The&lt;br/&gt;
$group code assumes that field types are homogeneous (this was previously&lt;br/&gt;
undocumented), and that led to this bug:  the user changed the way they stored&lt;br/&gt;
this field mid-way through lifetime of this collection.  Because of the above&lt;br/&gt;
assumptions, the $group code didn&apos;t group together (for example) the values&lt;br/&gt;
NumberInt(24), NumberLong(24), and 24 (the JavaScript double precision floating&lt;br/&gt;
point number).&lt;/p&gt;

&lt;p&gt;The fix adds code so that those values are all treated as being the same.&lt;br/&gt;
However, there are some internal details that will still show through.  When&lt;br/&gt;
a new group bucket is created, the first value for that bucket will be used&lt;br/&gt;
as its key.  If a collection uses a mixed set of types for a value that is&lt;br/&gt;
used for a grouping key, then the output will be similarly mixed, because the&lt;br/&gt;
order that values of these types are seen for different values may not&lt;br/&gt;
necessarily be the same.  Clients should be aware of this difference, which&lt;br/&gt;
will manifest in strongly typed programming languages such as C/C++ or Java.&lt;br/&gt;
This shouldn&apos;t introduce any additional complexity, because if the application&lt;br/&gt;
was using mixed types before, then it already must have logic for detecting&lt;br/&gt;
the types of these values after they are fetched.  This is simply a warning&lt;br/&gt;
that this requirement will continue into their use of aggregation results.&lt;/p&gt;</comment>
                            <comment id="96424" author="samk" created="Wed, 7 Mar 2012 16:43:45 +0000"  >&lt;p&gt;Could you illuminate the documentation change that you think is required? It seems like the previous behavior wasn&apos;t documented, but perhaps I&apos;m missing something.&lt;/p&gt;</comment>
                            <comment id="96166" author="auto" created="Wed, 7 Mar 2012 01:24:16 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;cwestin&apos;, u&apos;name&apos;: u&apos;U-tellus\\cwestin&apos;, u&apos;email&apos;: u&apos;cwestin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-5209&quot; title=&quot;can&amp;#39;t compare values of BSON types 16 and 18 &quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-5209&quot;&gt;&lt;del&gt;SERVER-5209&lt;/del&gt;&lt;/a&gt; aggregation promotes numeric values when necessary&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/05604645b421fa934b2db313b0d96a0bcc4fb5ad&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/05604645b421fa934b2db313b0d96a0bcc4fb5ad&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="32452">SERVER-5239</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="15175" name="aggregationGroupBy.txt" size="588" author="tcgarvin" created="Mon, 5 Mar 2012 18:50:13 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 7 Mar 2012 01:24:16 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 50 weeks 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_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10020"><![CDATA[Linux]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>cwestin</customfieldvalue>
            <customfieldvalue>sam.kleinman</customfieldvalue>
            <customfieldvalue>tcgarvin</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hroas7:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8737</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|hrjd5j:</customfieldvalue>

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