<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:56:07 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-1119] Under v8, objects in map() have null value for .constructor</title>
                <link>https://jira.mongodb.org/browse/SERVER-1119</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;From my forum post at:&lt;br/&gt;
&lt;a href=&quot;http://groups.google.com/group/mongodb-user/browse_thread/thread/2e99cf6df485f0f5#&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/browse_thread/thread/2e99cf6df485f0f5#&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under V8, the &apos;this&apos; object in the map function of a mapreduce call has a null value for .constructor. I&apos;m not sure if this if malformed JS, or by design, but if it is by design, then it would be nice if tojson() could handle such objects (issue 1118)&lt;/p&gt;

&lt;p&gt;Reproducing the test case from the forum post:&lt;/p&gt;

&lt;p&gt;&amp;gt; rec = &lt;/p&gt;
{foo: &apos;bar&apos;}
{ &quot;foo&quot; : &quot;bar&quot; }
&lt;p&gt;&amp;gt; db.test_coll.save(rec)&lt;br/&gt;
&amp;gt; reduceTest = function(key, valueArray) &lt;/p&gt;
{

... print(&quot;in reduceTest&quot;);
... return 2;
... }
&lt;p&gt;;&lt;br/&gt;
&amp;gt; mapTest = function() &lt;/p&gt;
{

 ...  print(&quot;in mapTest&quot;);
...  emit(&apos;blah&apos;, 1);
... }
&lt;p&gt;&amp;gt; var res = db.runCommand( &lt;/p&gt;
{mapreduce: &apos;test_coll&apos;, map: mapTest, reduce: reduceTest, out: &apos;test_mr_out1&apos;, verbose: true}
&lt;p&gt;);&lt;br/&gt;
&amp;gt; res&lt;/p&gt;
{

        &quot;result&quot; : &quot;test_mr_out1&quot;,

//... etc ...

        }
&lt;p&gt;,&lt;br/&gt;
        &quot;ok&quot; : 1&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;// works fine without tojson() call&lt;/p&gt;

&lt;p&gt;&amp;gt; mapTestFail = function() &lt;/p&gt;
{

... print(&quot;in mapTest&quot;);
... print(tojson(this));
... emit(&apos;blah&apos;, 1);
... }
&lt;p&gt;;&lt;br/&gt;
&amp;gt; var res = db.runCommand( &lt;/p&gt;
{mapreduce: &apos;test_coll&apos;, map: mapTestFail, reduce: reduceTest, out: &apos;test_mr_out1&apos;, verbose: true}
&lt;p&gt;);&lt;br/&gt;
&amp;gt; res&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
        &quot;errmsg&quot; : &quot;assertion: map invoke failed: error in invoke:&lt;br/&gt;
localConnect 1:397 TypeError: Cannot read property &apos;tojson&apos; of null&lt;br/&gt;
if ( typeof( x.constructor.tojson ) == \&quot;function\&quot; &amp;amp;&amp;amp;&lt;br/&gt;
x.constructor.tojson != t&lt;br/&gt;
                          ^&lt;br/&gt;
&quot;,&lt;br/&gt;
        &quot;ok&quot; : 0&lt;br/&gt;
} &lt;/p&gt;

&lt;p&gt;It&apos;s likely that something out of this and 1118 is invalid, but I feel that at least one of them is probably a valid issue.&lt;/p&gt;</description>
                <environment>OS X, with v8 build</environment>
        <key id="11962">SERVER-1119</key>
            <summary>Under v8, objects in map() have null value for .constructor</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="eliot">Eliot Horowitz</assignee>
                                    <reporter username="admackin">Andy MacKinlay</reporter>
                        <labels>
                    </labels>
                <created>Fri, 14 May 2010 01:00:11 +0000</created>
                <updated>Fri, 14 May 2010 10:06:42 +0000</updated>
                            <resolved>Fri, 14 May 2010 10:06:42 +0000</resolved>
                                    <version>1.4.2</version>
                                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="14257" author="eliot" created="Fri, 14 May 2010 10:06:42 +0000"  >&lt;p&gt;This is fine - fixed SERVER--1118&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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 14 May 2010 10:06:42 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            13 years, 40 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>admackin</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpmgv:</customfieldvalue>

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

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

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