<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:12:41 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-26623] call deleteOne with an array in shell</title>
                <link>https://jira.mongodb.org/browse/SERVER-26623</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.mycoll.deleteOne([])&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;2016-10-13T22:51:09.884+0200 E QUERY    [thread1] TypeError: err.hasWriteErrors is not a function :&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;DBCollection.prototype.deleteOne@src/mongo/shell/crud_api.js:328:13&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;@(shell):1:1&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;I accidentally ran deleteOne with an array. When you do that you should get an error, but I think this is an internal bug in the shell.&lt;/p&gt;


&lt;p&gt;BTW: I couldn&apos;t find the right project for the shell, so I filed it under tools.&lt;/p&gt;</description>
                <environment>macOSX (installed with brew)</environment>
        <key id="323550">SERVER-26623</key>
            <summary>call deleteOne with an array in shell</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="9">Done</resolution>
                                        <assignee username="jonathan.reams@mongodb.com">Jonathan Reams</assignee>
                                    <reporter username="jaap@q42.nl">Jaap Taal</reporter>
                        <labels>
                    </labels>
                <created>Thu, 13 Oct 2016 20:56:40 +0000</created>
                <updated>Tue, 16 Nov 2021 16:57:32 +0000</updated>
                            <resolved>Tue, 7 Feb 2017 20:28:08 +0000</resolved>
                                    <version>3.2.10</version>
                                    <fixVersion>3.5.3</fixVersion>
                                    <component>Shell</component>
                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="1496016" author="xgen-internal-githook" created="Thu, 9 Feb 2017 16:12:25 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jbreams&apos;, u&apos;name&apos;: u&apos;Jonathan Reams&apos;, u&apos;email&apos;: u&apos;jbreams@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-26623&quot; title=&quot;call deleteOne with an array in shell&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-26623&quot;&gt;&lt;del&gt;SERVER-26623&lt;/del&gt;&lt;/a&gt; Check whether error is BulkWriteError before unpacking it&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/1b49f7f0e3d72662ddf81d7c3ed5254d874a0673&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/1b49f7f0e3d72662ddf81d7c3ed5254d874a0673&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1494340" author="xgen-internal-githook" created="Tue, 7 Feb 2017 21:08:51 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ksuarz&apos;, u&apos;name&apos;: u&apos;Kyle Suarez&apos;, u&apos;email&apos;: u&apos;kyle.suarez@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-26623&quot; title=&quot;call deleteOne with an array in shell&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-26623&quot;&gt;&lt;del&gt;SERVER-26623&lt;/del&gt;&lt;/a&gt; fix lint&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/2c1cce8c3b1920a307a376bcc3b91edb79cf110a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/2c1cce8c3b1920a307a376bcc3b91edb79cf110a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1494279" author="xgen-internal-githook" created="Tue, 7 Feb 2017 20:27:47 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jbreams&apos;, u&apos;name&apos;: u&apos;Jonathan Reams&apos;, u&apos;email&apos;: u&apos;jbreams@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-26623&quot; title=&quot;call deleteOne with an array in shell&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-26623&quot;&gt;&lt;del&gt;SERVER-26623&lt;/del&gt;&lt;/a&gt; Propagate bulk api write errors in shell CRUD api&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/14c608a79b22876bfed4769d9a0c3eb47e8f8d96&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/14c608a79b22876bfed4769d9a0c3eb47e8f8d96&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1491141" author="jonathan.reams@10gen.com" created="Thu, 2 Feb 2017 18:59:29 +0000"  >&lt;p&gt;I think the problem here is that when we execute a bulk api it checks whether there are any errors and throws them as a &lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/src/mongo/shell/bulk_api.js#L1172&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;BulkWriteError&lt;/a&gt;, which is just a &lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/src/mongo/shell/bulk_api.js#L355&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;fancy error&lt;/a&gt; - so by the time it reaches &lt;a href=&quot;https://github.com/mongodb/mongo/blob/master/src/mongo/shell/crud_api.js#L244&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;this code&lt;/a&gt; that I think is meant to convert an array of errors its already a single Error. I think we should just remove that try/catch block in all the single write APIs and let the bulk write API format the errors they way it wants.&lt;/p&gt;</comment>
                            <comment id="1419264" author="jaap@q42.nl" created="Thu, 27 Oct 2016 09:50:47 +0000"  >&lt;p&gt;If it&apos;s not fixable, this issue should be closed of course.&lt;/p&gt;</comment>
                            <comment id="1419263" author="jaap@q42.nl" created="Thu, 27 Oct 2016 09:48:44 +0000"  >&lt;p&gt;Fair enough, it&apos;s just that I tought that&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;TypeError: err.hasWriteErrors is not a function&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;was an error that usually indcates some precondition for a piece of code is violated. I was guessing it should be possible to raise a more specific error, because &lt;tt&gt;err&lt;/tt&gt; is some internal variable.&lt;/p&gt;</comment>
                            <comment id="1418969" author="jason.carey" created="Wed, 26 Oct 2016 22:23:45 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jaap%40q42.nl&quot; class=&quot;user-hover&quot; rel=&quot;jaap@q42.nl&quot;&gt;jaap@q42.nl&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Unfortunately, the shell lacks the kind of pervasive argument checking necessary to validate that all forms of input are sane.  In this particular case, you&apos;re experiencing JavaScript&apos;s inclination to treat Array&apos;s as Objects, and that the filter argument to deleteOne is a generic object, rather than some more formal type.  Thus, [] becomes {}, which becomes deleteOne({}).&lt;/p&gt;

&lt;p&gt;Given that existing code out in the wild requires only that filter be an object (rather than having a specific prototype/constructor) it would be a backwards breaking change for us to begin constraining that space to specifically plain objects (or to one of our choosing).  So while I&apos;m sympathetic that array is clearly not a reasonable option, closing that loophole would leave:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;db.mycoll.deleteOne(mySpecialObjectType)&lt;/li&gt;
	&lt;li&gt;db.mycoll.deleteOne(
{ didnt_mean_to_pass_this : 1}
&lt;p&gt;)&lt;/p&gt;&lt;/li&gt;
	&lt;li&gt;db.mycoll.deleteOne(/regex/)&lt;/li&gt;
	&lt;li&gt;etc.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Let alone equivalent problems across the entire shell javascript api.&lt;/p&gt;

&lt;p&gt;If we ever end up writing a new shell, with a new api, I&apos;d be interested in a vastly more type-constrained interface.  Unfortunately, that&apos;s not something that we can tackle at this time in the current shell codebase.&lt;/p&gt;


</comment>
                            <comment id="1407962" author="thomas.schubert" created="Thu, 13 Oct 2016 21:29:56 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=q42jaap&quot; class=&quot;user-hover&quot; rel=&quot;q42jaap&quot;&gt;q42jaap&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thank you for the report. I&apos;ve assigned this issue to the Platforms Team to continue to investigate. Please continue to watch this ticket for updates.&lt;/p&gt;

&lt;p&gt;Kind regards,&lt;br/&gt;
Thomas&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.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>Thu, 13 Oct 2016 21:29:56 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        7 years, 6 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, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_16465" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Linked BF Score</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10021"><![CDATA[OS X]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>jaap@q42.nl</customfieldvalue>
            <customfieldvalue>jonathan.reams@mongodb.com</customfieldvalue>
            <customfieldvalue>kelsey.schubert@mongodb.com</customfieldvalue>
            <customfieldvalue>mira.carey@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjte7:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1347">Platforms 2016-10-31</customfieldvalue>
    <customfieldvalue id="1518">Platforms 2017-02-13</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|hri7kn:</customfieldvalue>

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