<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:23:33 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-10586] Mongo shell&apos;s &quot;null&quot; vs. &quot;undefined&quot; madness continues</title>
                <link>https://jira.mongodb.org/browse/SERVER-10586</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Using the Mongo shell, I am able to create documents whose properties &lt;b&gt;should&lt;/b&gt; be `undefined`; these properties are printed to the screen as `null`, however, and therefore they were difficult to remove. The code that I have included below is deceptively simple, but it is distilled from production code. It indicates that there are fundamental problems in the way that MongoDB developers treat JavaScript &amp;#8211; either they do not understand it themselves, or they do not expect others to understand it. It&apos;s obvious that Mongo&apos;s shell breaks with standards-compliant behavior in collection preallocation, for example, but this error is unacceptable. MongoDB&apos;s &quot;untyped&quot; nature is very useful for cleaning up messy datasets, as opposed to SQL, but in this case it actually made things much more difficult because I knew there were `null` values in there somewhere, but I couldn&apos;t actually find them.&lt;/p&gt;</description>
                <environment>Mac OS X 10.8.4 / XCode 4.6.3 / Homebrew updated daily&lt;br/&gt;
CentOS 6.4</environment>
        <key id="86764">SERVER-10586</key>
            <summary>Mongo shell&apos;s &quot;null&quot; vs. &quot;undefined&quot; madness continues</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="wilkinson">Sean Wilkinson</reporter>
                        <labels>
                    </labels>
                <created>Tue, 20 Aug 2013 22:54:27 +0000</created>
                <updated>Wed, 10 Dec 2014 23:04:45 +0000</updated>
                            <resolved>Sat, 24 Aug 2013 13:17:34 +0000</resolved>
                                    <version>2.4.5</version>
                                                    <component>Shell</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="410637" author="dan@10gen.com" created="Sat, 24 Aug 2013 13:17:34 +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="408345" author="wilkinson" created="Wed, 21 Aug 2013 17:36:49 +0000"  >&lt;p&gt;I upgraded to version 2.4.6 on Mac OS X (same platform given above) just now and confirmed that the bug is also present in 2.4.6.&lt;/p&gt;</comment>
                            <comment id="407792" author="wilkinson" created="Tue, 20 Aug 2013 22:58:22 +0000"  >&lt;p&gt;I had previously opened a ticket (&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-1747&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/DOCS-1747&lt;/a&gt;) because I thought there was just a bug in the documentation that listed the BSON type code for `null` incorrectly, but that wasn&apos;t the real issue. Instead, the real culprit is the MongoDB shell itself.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="41411">SERVER-6102</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 24 Aug 2013 13:17:34 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 25 weeks, 4 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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            10 years, 25 weeks, 4 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>dan@mongodb.com</customfieldvalue>
            <customfieldvalue>wilkinson</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrmitj:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>79534</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;For some empty collection &quot;foo&quot;, try the following:&lt;/p&gt;

&lt;p&gt;&amp;gt; var bar;&lt;br/&gt;
&amp;gt; db.foo.save(&lt;/p&gt;
{bar: bar}
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;Now, look at the document that was created:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.foo.findOne();&lt;/p&gt;
{ &quot;_id&quot; : ObjectId(&quot;5213ede21269f7d12659b3ea&quot;), &quot;bar&quot; : null }

&lt;p&gt;Oh, okay, so I can isolate such a document to remove it from a dataset, right? WRONG.&lt;/p&gt;

&lt;p&gt;&amp;gt; db.foo.find(&lt;/p&gt;
{bar: null}
&lt;p&gt;).length()&lt;br/&gt;
0&lt;br/&gt;
&amp;gt; db.foo.find({bar: {$type: 10}}).length()&lt;br/&gt;
0&lt;br/&gt;
&amp;gt; db.foo.find({bar: {$type: 6}}).length()&lt;br/&gt;
1&lt;/p&gt;

&lt;p&gt;Oh, so it was `undefined` all along? That makes sense, except that it lied to me and said it was `null`. So that means the following &lt;b&gt;single line&lt;/b&gt; will cause the same problems, won&apos;t it?&lt;/p&gt;

&lt;p&gt;&amp;gt; db.foo.save(&lt;/p&gt;
{bar: undefined}
&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;Yes. Yes it will.&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|hspci7:</customfieldvalue>

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