<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:53:20 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-61795] Incorrect Usage of Javascript Comparison to Compare Arrays and Objects</title>
                <link>https://jira.mongodb.org/browse/SERVER-61795</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The tests in&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/fcd1982137ce70e65efd6a7f04b6360e0552fdc6/jstests/aggregation/expressions/expression_trigonometric.js#L25&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;expression_trigonometric.js&lt;/a&gt;&#160;use&#160;&lt;em&gt;assert.lt&lt;/em&gt; (in &lt;a href=&quot;https://github.com/mongodb/mongo/blob/fcd1982137ce70e65efd6a7f04b6360e0552fdc6/jstests/aggregation/expressions/expression_trigonometric.js#L25&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;) to compare the array of results returned from the aggregation pipeline with an array created in JavaScript. Then, the implementation of&#160;&lt;em&gt;assert.lt&lt;/em&gt; (in &lt;a href=&quot;https://github.com/mongodb/mongo/blob/fcd1982137ce70e65efd6a7f04b6360e0552fdc6/src/mongo/shell/assert.js#L998&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;) uses the &amp;lt; JavaScript operator to perform the less-than comparison. As JavaScript does not provide operator overloading, to perform the comparison between arrays or objects, calls &lt;em&gt;toString&lt;/em&gt; on them and compares the results. For objects, &lt;em&gt;toString&lt;/em&gt; always returns &quot;&lt;span class=&quot;error&quot;&gt;&amp;#91;object Object&amp;#93;&lt;/span&gt;&quot; for JavaScript-created objects and &quot;&lt;span class=&quot;error&quot;&gt;&amp;#91;object BSON&amp;#93;&lt;/span&gt;&quot; for BSON objects (usually returned from an aggregation pipeline). Then, the comparison&#160;&lt;a href=&quot;https://github.com/mongodb/mongo/blob/fcd1982137ce70e65efd6a7f04b6360e0552fdc6/jstests/aggregation/expressions/expression_trigonometric.js#L25&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&#160;always returns &lt;em&gt;true&lt;/em&gt; irrespective of the values, as long as a value exists.&lt;/p&gt;

&lt;p&gt;This is just one instance and we should keep an eye for other tests that might suffer from the same incorrect usage of JavaScript comparison operators.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1938958">SERVER-61795</key>
            <summary>Incorrect Usage of Javascript Comparison to Compare Arrays and Objects</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="justin.seyster@mongodb.com">Justin Seyster</assignee>
                                    <reporter username="mohammad.dashti@mongodb.com">Mohammad Dashti</reporter>
                        <labels>
                            <label>greenerbuild</label>
                            <label>neweng</label>
                    </labels>
                <created>Tue, 30 Nov 2021 07:02:31 +0000</created>
                <updated>Sun, 29 Oct 2023 21:45:31 +0000</updated>
                            <resolved>Thu, 10 Feb 2022 01:59:04 +0000</resolved>
                                    <version>5.1.0-rc3</version>
                                    <fixVersion>5.3.0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4340973" author="xgen-internal-githook" created="Mon, 7 Feb 2022 23:33:34 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Justin Seyster&apos;, &apos;email&apos;: &apos;justin.seyster@mongodb.com&apos;, &apos;username&apos;: &apos;jseyster&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-61795&quot; title=&quot;Incorrect Usage of Javascript Comparison to Compare Arrays and Objects&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-61795&quot;&gt;&lt;del&gt;SERVER-61795&lt;/del&gt;&lt;/a&gt; Fix comparisons in expression_trigonometric.js&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/52c017336905d7219ef6e3f51ee78c9dd958df4e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/52c017336905d7219ef6e3f51ee78c9dd958df4e&lt;/a&gt;&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_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 4 Feb 2022 02:21:26 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 2 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_17050" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Downstream Team Attention</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="16941"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-2052</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>
                            2 years, 2 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>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>justin.seyster@mongodb.com</customfieldvalue>
            <customfieldvalue>mohammad.dashti@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i0clrj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr27zj:</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;You can run the test like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;activate &amp;amp;&amp;amp; buildscripts/resmoke.py run --suites=aggregation --installDir=dist-test/bin --continueOnFailure --excludeWithAnyTags=requires_http_client --spawnUsing=python --jobs=4 --shuffle --storageEngineCacheSizeGB=1 jstests/aggregation/expressions/expression_trigonometric.js&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You can change the expected result of any test done with&#160;&lt;em&gt;testOpApprox&lt;/em&gt; in this file and all tests still pass. For example, you can replace:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;testOpApprox({$acos: NumberDecimal(1)}, NumberDecimal(0));&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;with:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;testOpApprox({$acos: NumberDecimal(1)}, NumberDecimal(100));&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;and the test-suite passes.&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|i0c7wv:</customfieldvalue>

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