<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:59:56 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-2426] Convert/print bson undefined type as javascript undefined, not null</title>
                <link>https://jira.mongodb.org/browse/SERVER-2426</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This snippet shows how an &quot;Undefined&quot; (0x06) BSON value may get stored into the database.&lt;/p&gt;

&lt;p&gt;use tempDB;&lt;br/&gt;
var obj = {};&lt;br/&gt;
db.tempColl.insert(&lt;/p&gt;
{ data: obj.undefinedField }
&lt;p&gt;);&lt;br/&gt;
db.tempColl.find(&lt;/p&gt;
{ data: null }
&lt;p&gt;);                       // expects one document but actually returns zero documents.&lt;br/&gt;
db.tempColl.find({ data: { $type: 10 }});         // expects one document but actually returns  zero documents.&lt;br/&gt;
db.tempColl.find({ data: { $type: 6 }});           // expects zero documents but returns one document.&lt;/p&gt;</description>
                <environment></environment>
        <key id="14340">SERVER-2426</key>
            <summary>Convert/print bson undefined type as javascript undefined, not null</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="3">Duplicate</resolution>
                                        <assignee username="backlog-server-platform">DO NOT USE - Backlog - Platform Team</assignee>
                                    <reporter username="buddydvd">David Hu</reporter>
                        <labels>
                    </labels>
                <created>Thu, 27 Jan 2011 23:04:56 +0000</created>
                <updated>Wed, 11 Nov 2015 16:15:30 +0000</updated>
                            <resolved>Wed, 11 Nov 2015 16:15:30 +0000</resolved>
                                                                    <component>JavaScript</component>
                    <component>Shell</component>
                                        <votes>2</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="1085684" author="jonathan.reams@10gen.com" created="Wed, 11 Nov 2015 16:15:30 +0000"  >&lt;p&gt;Duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6102&quot; title=&quot;Shell displays both &amp;#39;undefined&amp;#39; and &amp;#39;null&amp;#39; type as &amp;#39;null&amp;#39;&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6102&quot;&gt;&lt;del&gt;SERVER-6102&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="22860" author="eliot" created="Mon, 31 Jan 2011 06:50:07 +0000"  >&lt;p&gt;Agree it has to be consistent, but there are some reasons to keep undefined.&lt;/p&gt;

&lt;p&gt;So the real task is clearly laying out all js conversions and making sure its consistent.&lt;/p&gt;</comment>
                            <comment id="22797" author="buddydvd" created="Fri, 28 Jan 2011 20:59:36 +0000"  >&lt;p&gt;If you retrieve a document containing &quot;undefined&quot; BSON values and save it back into the collection, those &quot;undefined&quot; BSON will values get converted to &quot;null&quot; BSON values. Here&apos;s an example:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.temp.save({_id:1, b:{}.undefinedField});&lt;br/&gt;
&amp;gt; var doc = db.temp.findOne({_id:1, b:{$type: 6}});&lt;br/&gt;
&amp;gt; doc&lt;/p&gt;
{ &quot;_id&quot; : 1, &quot;b&quot; : null }
&lt;p&gt;&amp;gt; doc.c = &quot;str&quot;;&lt;br/&gt;
str&lt;br/&gt;
&amp;gt; db.temp.save(doc);&lt;br/&gt;
&amp;gt; db.temp.findOne({_id:1, b:{$type:6}});&lt;br/&gt;
null&lt;br/&gt;
&amp;gt; db.temp.findOne({_id:1, b:{$type:10}});&lt;/p&gt;
{ &quot;_id&quot; : 1, &quot;b&quot; : null, &quot;c&quot; : &quot;str&quot; }

&lt;p&gt;In v8_wrapper&apos;s mongoToV8Element function, &quot;undefined&quot; elements (0x06) get converted to v8::Null(). However, the v8ToMongoElement function converts v8 &quot;undefined&quot; elements to BSON &quot;undefined&quot; elements.&lt;/p&gt;</comment>
                            <comment id="22771" author="scotthernandez" created="Fri, 28 Jan 2011 06:09:10 +0000"  >&lt;p&gt;It is even easier than that.&lt;/p&gt;

&lt;p&gt;&amp;gt; printjson(&lt;/p&gt;
{a:undefined}
&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;undefined is a valid value in javascript, and in bson.&lt;/p&gt;

&lt;p&gt;What is the motivation for removing it? And why set it to null? It seems like if a field value is undefined then the field should be skipped, not set to null.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="141402">SERVER-14221</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="41411">SERVER-6102</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="217764">SERVER-19503</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>4.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, 28 Jan 2011 06:09:10 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            8 years, 14 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>buddydvd</customfieldvalue>
            <customfieldvalue>backlog-server-platform</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>jonathan.reams@mongodb.com</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrp7r3:</customfieldvalue>

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

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

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