<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:40:44 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-16343] $pull using DBRef $id and $in operator</title>
                <link>https://jira.mongodb.org/browse/SERVER-16343</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When I use $pull to remove some DBRef using $id and $in operator, none of them are remove.&lt;/p&gt;

&lt;p&gt;If the $id field have another name works.&lt;/p&gt;</description>
                <environment></environment>
        <key id="171616">SERVER-16343</key>
            <summary>$pull using DBRef $id and $in operator</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="-1">Unassigned</assignee>
                                    <reporter username="gabrielbrieva">Gabriel Brieva</reporter>
                        <labels>
                    </labels>
                <created>Thu, 27 Nov 2014 22:22:46 +0000</created>
                <updated>Fri, 28 Nov 2014 14:39:59 +0000</updated>
                            <resolved>Fri, 28 Nov 2014 09:42:07 +0000</resolved>
                                    <version>2.6.5</version>
                                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="774386" author="asya" created="Fri, 28 Nov 2014 14:39:59 +0000"  >&lt;p&gt;That case should not work - I believe that may be a bug.  I will check why this case works contrary to documentation.&lt;/p&gt;</comment>
                            <comment id="774367" author="gabrielbrieva" created="Fri, 28 Nov 2014 13:37:10 +0000"  >&lt;p&gt;But in this case works:&lt;/p&gt;

&lt;p&gt;Two documents:&lt;/p&gt;

&lt;p&gt;{ &quot;foo&quot; : &quot;test1&quot;, &quot;rel&quot; : [ &lt;/p&gt;
{ &quot;t&quot; : &quot;t&quot;, &quot;id&quot; : 2 }
&lt;p&gt;, &lt;/p&gt;
{ &quot;t&quot; : &quot;t&quot;, &quot;id&quot; : 3 }
&lt;p&gt; ] }&lt;/p&gt;

&lt;p&gt;{ &quot;foo&quot; : &quot;test2&quot;, &quot;rel&quot; : [ &lt;/p&gt;
{ &quot;t&quot; : &quot;t&quot;, &quot;id&quot; : 2 }
&lt;p&gt;, &lt;/p&gt;
{ &quot;t&quot; : &quot;t&quot;, &quot;id&quot; : 1 }
&lt;p&gt; ] }&lt;/p&gt;

&lt;p&gt;The query:&lt;/p&gt;

&lt;p&gt;db.test.update({}, {&quot;$pull&quot;: { &quot;rel&quot;: { &quot;id&quot;: &lt;/p&gt;
{ &quot;$in&quot;: [1, 3] }
&lt;p&gt; } } }, &lt;/p&gt;
{&quot;multi&quot;: true}
&lt;p&gt;)&lt;/p&gt;

&lt;p&gt;That query remove  &lt;/p&gt;
{&quot;t&quot; : &quot;t&quot;, &quot;id&quot; : 1}
&lt;p&gt; and  &lt;/p&gt;
{&quot;t&quot; : &quot;t&quot;, &quot;id&quot; : 3}
&lt;p&gt; from documents. So, why don&apos;t works for DBRef case?&lt;/p&gt;</comment>
                            <comment id="774314" author="asya" created="Fri, 28 Nov 2014 09:41:58 +0000"  >&lt;p&gt;The result you&apos;re getting is correct.&lt;/p&gt;

&lt;p&gt;Documentation for $pull specifies a number of behaviors:&lt;br/&gt;
&lt;a href=&quot;http://docs.mongodb.org/manual/reference/operator/update/pull/#up._S_pull&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/reference/operator/update/pull/#up._S_pull&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note it says:&lt;br/&gt;
If the specified &amp;lt;value&amp;gt; to remove is a document, $pull removes only the elements in the array that have the exact same fields and values. &lt;/p&gt;

&lt;p&gt;You are asking to pull by trying to match document where &quot;rel&quot; has the value {&lt;tt&gt;&quot;$id&quot;: ...&lt;/tt&gt;} which is not the object that &quot;rel&quot; has.&lt;/p&gt;

&lt;p&gt;What will work is:&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;db.test.update({},{&quot;$pull&quot;:{&quot;rel&quot;: { &quot;$in&quot;: [{&quot;$ref&quot;:&quot;bar&quot;,&quot;$id&quot;: ObjectId(&quot;54773af88328753e92484be8&quot;)}, {&quot;$ref&quot;:&quot;bar&quot;,&quot;$id&quot;:ObjectId(&quot;5477954518c7885d7651a15a&quot;)} ] } }})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&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>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 28 Nov 2014 09:41:58 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 11 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>
                            9 years, 11 weeks, 5 days ago
                        </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>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>gabrielbrieva</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlhsv:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>150274</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;I have this two documents:&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
    foo : &quot;test2&quot;,&lt;br/&gt;
    rel : [ &lt;br/&gt;
        &lt;/p&gt;
{
            $ref : &quot;bar&quot;,
            $id : ObjectId(&quot;54773af88328753e92484be8&quot;)
        }
&lt;p&gt;,&lt;/p&gt;
        {
            $ref : &quot;bar&quot;,
            $id : ObjectId(&quot;54480b5f18c7885d7651a140&quot;)
        }
&lt;p&gt;    ]&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
    foo : &quot;test2&quot;,&lt;br/&gt;
    rel : [ &lt;br/&gt;
        &lt;/p&gt;
{
            $ref : &quot;bar&quot;,
            $id : ObjectId(&quot;54480b5f18c7885d7651a140&quot;)
        }
&lt;p&gt;,&lt;/p&gt;
        {
            $ref : &quot;bar&quot;,
            $id : ObjectId(&quot;54773af88328753e92484be8&quot;)
        }
&lt;p&gt;    ]&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;When I use $pull to remove some of DBRef entries and using $in too, none of them are removed.&lt;/p&gt;

&lt;p&gt;This is the query:&lt;/p&gt;

&lt;p&gt;db.test.update({}, {$pull: &lt;br/&gt;
    { rel: &lt;br/&gt;
        { &quot;$id&quot;: &lt;/p&gt;
            { $in: [ ObjectId(&quot;54773af88328753e92484be8&quot;), ObjectId(&quot;5477954518c7885d7651a15a&quot;) ] } 
&lt;p&gt;        }&lt;br/&gt;
    }&lt;br/&gt;
})&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|hsgfnb:</customfieldvalue>

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