<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:55:05 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-770] objects serialised to system.js collection lose prototype and all methods defined outside the constructor</title>
                <link>https://jira.mongodb.org/browse/SERVER-770</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;when an object is serialized to system.js and then later instantiated, it loses its prototype and all methods defined outside its constructor.&lt;/p&gt;

&lt;p&gt;To see this, consider the following script&lt;/p&gt;

&lt;p&gt;    //currently this prints outputs and doesn&apos;t do any nice asserts&lt;br/&gt;
    //this si for clarity of bug reporting&lt;/p&gt;

&lt;p&gt;    var s = db.system.js;&lt;/p&gt;

&lt;p&gt;    PrototypicalInheritanceObject = function () &lt;/p&gt;
{
        this.constructor_assigned_property = &apos;this constructor_assigned_property exists&apos;;
    }

&lt;p&gt;    PrototypicalInheritanceObject.own_property = &apos;this own_property exists&apos;;&lt;/p&gt;

&lt;p&gt;    PrototypicalInheritanceObject.own_method = function () &lt;/p&gt;
{
        return &quot;this own_method exists&quot;;
    }

&lt;p&gt;    PrototypicalInheritanceObject.prototype.prototypical_property = &apos;this prototypical_property exists&apos;;&lt;/p&gt;

&lt;p&gt;    PrototypicalInheritanceObject.prototype.prototypical_method = function () &lt;/p&gt;
{
        return &quot;this prototypical_method exists&quot;;
    }&lt;br/&gt;
&lt;br/&gt;
    print(&quot;======================================&quot;);&lt;br/&gt;
    print(&quot;Client side&quot;);&lt;br/&gt;
    print(&quot;======================================&quot;);&lt;br/&gt;
&lt;br/&gt;
    //test that this behaves as normal in the shell interpreter&lt;br/&gt;
    var p = new PrototypicalInheritanceObject();&lt;br/&gt;
    print(&quot;constructor property - shell interpreter:&quot;);&lt;br/&gt;
    print(p.constructor_assigned_property);&lt;br/&gt;
    print(&quot;&quot;);&lt;br/&gt;
    print(&quot;own property - shell interpreter:&quot;);&lt;br/&gt;
    print(p.own_property);&lt;br/&gt;
    print(&quot;&quot;);&lt;br/&gt;
    print(&quot;own method - shell interpreter:&quot;);&lt;br/&gt;
    print(tojson(p.own_method));&lt;br/&gt;
    print(&quot;&quot;);&lt;br/&gt;
    print(&quot;prototypical property - shell interpreter:&quot;);&lt;br/&gt;
    print(p.prototypical_property);&lt;br/&gt;
    print(&quot;&quot;);&lt;br/&gt;
    print(&quot;prototypical method - shell interpreter:&quot;);&lt;br/&gt;
    print(tojson(p.prototypical_method));&lt;br/&gt;
&lt;br/&gt;
    print(&quot;======================================&quot;);&lt;br/&gt;
    print(&quot;server side&quot;);&lt;br/&gt;
    print(&quot;======================================&quot;);&lt;br/&gt;
    s.insert( { _id : &quot;PrototypicalInheritanceObject&quot;, value : PrototypicalInheritanceObject});&lt;br/&gt;
    print(&quot;constructor property - server interpreter:&quot;);&lt;br/&gt;
    print(db.eval(&quot;var p = new PrototypicalInheritanceObject(); return p.constructor_assigned_property&quot;));&lt;br/&gt;
    print(&quot;&quot;);&lt;br/&gt;
    print(&quot;own property - server interpreter:&quot;);&lt;br/&gt;
    print(db.eval(&quot;var p = new PrototypicalInheritanceObject(); return p.own_property&quot;));&lt;br/&gt;
    print(&quot;&quot;);&lt;br/&gt;
    print(&quot;own method - server interpreter:&quot;);&lt;br/&gt;
    print(db.eval(&quot;var p = new PrototypicalInheritanceObject(); return tojson(p.own_method)&quot;));&lt;br/&gt;
    print(&quot;&quot;);&lt;br/&gt;
    print(&quot;prototypical property - server interpreter:&quot;);&lt;br/&gt;
    print(db.eval(&quot;var p = new PrototypicalInheritanceObject(); return p.prototypical_property&quot;));&lt;br/&gt;
    print(&quot;&quot;);&lt;br/&gt;
    print(&quot;prototypical method - server interpreter:&quot;);&lt;br/&gt;
    print(db.eval(&quot;var p = new PrototypicalInheritanceObject(); return tojson(p.prototypical_property)&quot;));&lt;br/&gt;
&lt;br/&gt;
The output for the client side and server side phases seem like they should be the same, but they are not.&lt;br/&gt;
&lt;br/&gt;
    ======================================&lt;br/&gt;
    Client side&lt;br/&gt;
    ======================================&lt;br/&gt;
    constructor property - shell interpreter:&lt;br/&gt;
    this constructor_assigned_property exists&lt;br/&gt;
&lt;br/&gt;
    own property - shell interpreter:&lt;br/&gt;
    undefined&lt;br/&gt;
&lt;br/&gt;
    own method - shell interpreter:&lt;br/&gt;
    undefined&lt;br/&gt;
&lt;br/&gt;
    prototypical property - shell interpreter:&lt;br/&gt;
    this prototypical_property exists&lt;br/&gt;
&lt;br/&gt;
    prototypical method - shell interpreter:&lt;br/&gt;
    function () {        return &quot;this prototypical_method exists&quot;;    }
&lt;p&gt;    ======================================&lt;br/&gt;
    server side&lt;br/&gt;
    ======================================&lt;br/&gt;
    constructor property - server interpreter:&lt;br/&gt;
    this constructor_assigned_property exists&lt;/p&gt;

&lt;p&gt;    own property - server interpreter:&lt;br/&gt;
    null&lt;/p&gt;

&lt;p&gt;    own method - server interpreter:&lt;br/&gt;
    undefined&lt;/p&gt;

&lt;p&gt;    prototypical property - server interpreter:&lt;br/&gt;
    null&lt;/p&gt;

&lt;p&gt;    prototypical method - server interpreter:&lt;br/&gt;
    undefined&lt;/p&gt;</description>
                <environment>Mac OS 10.6 64 bit. Seems to be JS-based, so probably all.</environment>
        <key id="11536">SERVER-770</key>
            <summary>objects serialised to system.js collection lose prototype and all methods defined outside the 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="9">Done</resolution>
                                        <assignee username="eliot">Eliot Horowitz</assignee>
                                    <reporter username="howthebodyworks">dan</reporter>
                        <labels>
                    </labels>
                <created>Tue, 16 Mar 2010 18:56:39 +0000</created>
                <updated>Tue, 16 Mar 2010 20:42:44 +0000</updated>
                            <resolved>Tue, 16 Mar 2010 20:42:44 +0000</resolved>
                                    <version>1.3.3</version>
                                                    <component>JavaScript</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="13074" author="eliot" created="Tue, 16 Mar 2010 20:42:44 +0000"  >&lt;p&gt;more on mongodb-user&lt;/p&gt;</comment>
                            <comment id="13072" author="howthebodyworks" created="Tue, 16 Mar 2010 19:11:49 +0000"  >&lt;p&gt;Unsure if I&apos;ve been missing the point here, so I opened up a discussion on mongo-users pertaining to this issue:&lt;br/&gt;
&lt;a href=&quot;http://groups.google.com/group/mongodb-user/t/27aaf8261b5fff46&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/t/27aaf8261b5fff46&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>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 16 Mar 2010 20:42:44 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        13 years, 49 weeks, 1 day 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, 49 weeks, 1 day 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>howthebodyworks</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|hrpqdj:</customfieldvalue>

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

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

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