<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:57:42 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-1672] (new NumberLong(3754)==new NumberLong(3754)) evals to false</title>
                <link>https://jira.mongodb.org/browse/SERVER-1672</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&amp;gt; (new NumberLong(3754)==new NumberLong(3754))               &lt;br/&gt;
false&lt;br/&gt;
&amp;gt; &lt;/p&gt;

&lt;p&gt;I ran into this issue when creating a $where function that compared numbers.&lt;/p&gt;</description>
                <environment>Ubuntu Linux - mongo client console</environment>
        <key id="12899">SERVER-1672</key>
            <summary>(new NumberLong(3754)==new NumberLong(3754)) evals to false</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="5" iconUrl="https://jira.mongodb.org/images/icons/priorities/trivial.svg">Trivial - P5</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="backlog-server-platform">DO NOT USE - Backlog - Platform Team</assignee>
                                    <reporter username="briandilley">Brian C. Dilley</reporter>
                        <labels>
                    </labels>
                <created>Tue, 24 Aug 2010 21:51:25 +0000</created>
                <updated>Mon, 8 Jan 2024 15:23:17 +0000</updated>
                            <resolved>Fri, 20 May 2016 20:29:25 +0000</resolved>
                                    <version>1.6.1</version>
                                                    <component>JavaScript</component>
                                        <votes>3</votes>
                                    <watches>10</watches>
                                                                                                                <comments>
                            <comment id="1270590" author="jason.carey" created="Fri, 20 May 2016 20:29:25 +0000"  >&lt;p&gt;Javascript as an ecosystem has made a decision not to support operator overloading, so however much we&apos;d like to make our types operate as native types, we just can&apos;t provide those semantics.&lt;/p&gt;

&lt;p&gt;It might be worth considering an arithmetic library solution that could be extended with our types, but that wouldn&apos;t be the asked for functionality in this ticket.&lt;/p&gt;</comment>
                            <comment id="114733" author="sfnelson" created="Mon, 30 Apr 2012 05:21:31 +0000"  >&lt;p&gt;Workaround: use String(NumberLong(..)) to compare string representations.&lt;/p&gt;</comment>
                            <comment id="54951" author="briandilley" created="Sat, 17 Sep 2011 19:12:18 +0000"  >&lt;p&gt;How is this a &quot;feature request&quot;.  We&apos;re unable to compare equality for numbers of type NumberLong!  There must be a way to define an equals implementation for objects in V8... in fact, does it just not use whatever the underlying c++ object uses for equality (ie: == operator)?&lt;/p&gt;
</comment>
                            <comment id="54922" author="guanqun" created="Sat, 17 Sep 2011 10:10:47 +0000"  >&lt;p&gt;@Antoine I agree that if it&apos;s hard to implement it in v8, then we just ignore this feature request...&lt;/p&gt;</comment>
                            <comment id="54913" author="antoine" created="Sat, 17 Sep 2011 06:42:23 +0000"  >&lt;p&gt;Looking at v8 sources, it doesnt seem that there is a way to override the equals behavior.&lt;br/&gt;
When 2 objects are compared, they are only equal if they are the exact same object.&lt;br/&gt;
In v8:&lt;br/&gt;
  i::Handle&amp;lt;i::Object&amp;gt; obj = Utils::OpenHandle(this);&lt;br/&gt;
  i::Handle&amp;lt;i::Object&amp;gt; other = Utils::OpenHandle(*that);&lt;br/&gt;
  if (obj-&amp;gt;IsJSObject() &amp;amp;&amp;amp; other-&amp;gt;IsJSObject()) &lt;/p&gt;
{
    return *obj == *other;
  }

&lt;p&gt;One way to compare would be:&lt;br/&gt;
NumberLong(3754).toNumber() == NumberLong(3754).toNumber()&lt;br/&gt;
or&lt;br/&gt;
NumberLong(3754).valueOf() == NumberLong(3754).valueOf()&lt;br/&gt;
We could modify the v8 source to enable overriding this behavior, but that would make updating v8 painful.&lt;/p&gt;</comment>
                            <comment id="37177" author="nakamura" created="Sun, 12 Jun 2011 20:40:25 +0000"  >&lt;p&gt;I think it&apos;s more important that (new NumberLong(3754)===new NumberLong(3754)) evaluates to true, rather than with the == equality operator.  The == operator should eval both of the NumberLong(3754) to native js 3754 numbers before comparing equality, while === should keep them in NumberLong format and see if they are identical.&lt;/p&gt;</comment>
                            <comment id="22205" author="guanqun" created="Mon, 10 Jan 2011 10:00:00 +0000"  >&lt;p&gt;v8 doesn&apos;t have as many documents as spidermonkey does. not sure how to do this...&lt;/p&gt;

&lt;p&gt;btw: I&apos;m ok with the test case being commented out.&lt;br/&gt;
  &lt;a href=&quot;https://github.com/guanqun/mongo/commit/730a5d9501b73fc2352138a349799d51fb6c551d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/guanqun/mongo/commit/730a5d9501b73fc2352138a349799d51fb6c551d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="22186" author="eliot" created="Sat, 8 Jan 2011 16:13:47 +0000"  >&lt;p&gt;The only problem with merging this is we need to support v8 at the same time.&lt;br/&gt;
Anyone want to take a stab at that?&lt;br/&gt;
if not we can comment out the test for now.&lt;/p&gt;</comment>
                            <comment id="22182" author="guanqun" created="Sat, 8 Jan 2011 12:37:05 +0000"  >&lt;p&gt;Thanks to Brian&apos;s directions, I&apos;ve made up a simple patch for this and add three test cases for it.&lt;br/&gt;
    &lt;a href=&quot;https://github.com/guanqun/mongo/commit/4db464aa29729325651cd0d41e7de015ce5033ea&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/guanqun/mongo/commit/4db464aa29729325651cd0d41e7de015ce5033ea&lt;/a&gt;&lt;br/&gt;
though, it&apos;s only for spidermonkey.&lt;/p&gt;</comment>
                            <comment id="17445" author="eliot" created="Thu, 26 Aug 2010 04:34:47 +0000"  >&lt;p&gt;Hmm.. missed that.&lt;br/&gt;
We need to be able to do in spidermonkey and v8.&lt;br/&gt;
Will see if there is v8 option as well&lt;/p&gt;</comment>
                            <comment id="17444" author="briandilley" created="Thu, 26 Aug 2010 04:32:06 +0000"  >&lt;p&gt;Although I haven&apos;t looked at the mongo code at all - i have embedded SpiderMonkey in various applications and game engines - usually you use an JSEqualityOp callback on the JSExtendedClass:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en/JSExtendedClass&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://developer.mozilla.org/en/JSExtendedClass&lt;/a&gt;&lt;/p&gt;
</comment>
                            <comment id="17418" author="eliot" created="Wed, 25 Aug 2010 21:01:52 +0000"  >&lt;p&gt;This is nearly impossible because of javascript semantics.&lt;/p&gt;

&lt;p&gt;Unless someone else knows how to do this - I think is not going to be doable.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="40500">SERVER-6010</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="14963">SERVER-2667</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="243460">SERVER-21861</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>12.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>Wed, 25 Aug 2010 21:01:52 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            7 years, 38 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_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>antoine</customfieldvalue>
            <customfieldvalue>briandilley</customfieldvalue>
            <customfieldvalue>backlog-server-platform</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>guanqun</customfieldvalue>
            <customfieldvalue>mira.carey@mongodb.com</customfieldvalue>
            <customfieldvalue>nakamura</customfieldvalue>
            <customfieldvalue>sfnelson</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpgnz:</customfieldvalue>

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

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

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