<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:40:22 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-56855] $set tries to update _id with case insensitive collation</title>
                <link>https://jira.mongodb.org/browse/SERVER-56855</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;h3&gt;&lt;a name=&quot;ProblemDescription&quot;&gt;&lt;/a&gt;Problem Description&lt;/h3&gt;

&lt;p&gt;This initially started off as&#160;TOOLS-2865&lt;/p&gt;

&lt;p&gt;When performing an update with a $set containing an _id, the server does not ignore the new _id value if it is the same as the current value when using a case-insensitive collation.&lt;/p&gt;
&lt;h3&gt;&lt;a name=&quot;StepstoReproduce&quot;&gt;&lt;/a&gt;Steps to Reproduce&lt;/h3&gt;
&lt;div class=&apos;table-wrap&apos;&gt;
&lt;table class=&apos;confluenceTable&apos;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;db.createCollection(&quot;testimpcase&quot;, {collation: {locale: &quot;en&quot;, strength: 1}})&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&apos;confluenceTd&apos;&gt;db.testimpcase.insertOne({_id: &quot;abc&quot;, value: 1})&lt;br/&gt;
db.testimpcase.updateOne({_id: &quot;abc&quot;}, {&quot;$set&quot; : { _id: &quot;ABC&quot;}}) &lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;

&lt;h3&gt;&lt;a name=&quot;ExpectedResults&quot;&gt;&lt;/a&gt;Expected Results&lt;/h3&gt;

&lt;p&gt;The server should return a 0 documents modified.&lt;/p&gt;
&lt;h3&gt;&lt;a name=&quot;ActualResults&quot;&gt;&lt;/a&gt;Actual Results&lt;/h3&gt;

&lt;p&gt;Error, _id is immutable&lt;/p&gt;
&lt;h3&gt;&lt;a name=&quot;AdditionalNotes&quot;&gt;&lt;/a&gt;Additional Notes&lt;/h3&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1710893">SERVER-56855</key>
            <summary>$set tries to update _id with case insensitive collation</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="13202">Works as Designed</resolution>
                                        <assignee username="eric.sedor@mongodb.com">Eric Sedor</assignee>
                                    <reporter username="nitin.katkam@mongodb.com">Nitin Katkam</reporter>
                        <labels>
                    </labels>
                <created>Tue, 11 May 2021 16:35:48 +0000</created>
                <updated>Fri, 27 Oct 2023 13:52:24 +0000</updated>
                            <resolved>Wed, 12 May 2021 14:12:18 +0000</resolved>
                                    <version>4.4.5</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3768317" author="nitin.katkam" created="Wed, 12 May 2021 06:23:55 +0000"  >&lt;p&gt;Let&apos;s close this server ticket. On TOOLS-2865, it&apos;s been acknowledged that this is not a server issue and has to be fixed in MongoImport.&lt;/p&gt;</comment>
                            <comment id="3768311" author="nitin.katkam" created="Wed, 12 May 2021 06:18:35 +0000"  >&lt;p&gt;I agree with you on the change in case being a real change (Eg. if someone accidentally typed a country code in lower case and the DB didn&apos;t allow changing to upper case, they wouldn&apos;t be able to run an update query to correct it).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;UPDATE:&lt;/b&gt; TOOLS-2865 has been re-opened (was &quot;Works as designed&quot;, is &quot;In Progress&quot;)&lt;/p&gt;

&lt;p&gt;The expectation from the Tools team was that if query 2 (below) works then query 3 should work the same way because, if the filter for _id matches the document, it shouldn&apos;t be setting a value against _id&#160;(On a separate note, if I were writing a custom import tool, I wouldn&apos;t be including the _id within the $set, but this is how MongoImport works)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&amp;gt; db.createCollection(&quot;bugrepro&quot;, {collation:{locale:&quot;en&quot;,strength:1&lt;/tt&gt;)}}&lt;/p&gt;

&lt;p&gt;{{&lt;/p&gt;
{ &quot;ok&quot; : 1 }
&lt;p&gt;}}&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;//&lt;b&gt;QUERY 1&lt;/b&gt;: This is to create the initial document&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&amp;gt; db.bugrepro.updateOne({_id: &quot;nitin&quot;}, {$set: {_id: &quot;nitin&quot;, counter: 1&lt;/tt&gt;, {upsert: true})}}&lt;/p&gt;

&lt;p&gt;{{&lt;/p&gt;
{ &quot;acknowledged&quot; : true, &quot;matchedCount&quot; : 0, &quot;modifiedCount&quot; : 0, &quot;upsertedId&quot; : &quot;nitin&quot;}
&lt;p&gt;}}&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;//&lt;b&gt;QUERY 2&lt;/b&gt;: The filter matches lowercase _id and the $set has no change with lowercase _id&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&amp;gt; db.bugrepro.updateOne({_id: &quot;nitin&quot;}, {$set: {_id: &quot;nitin&quot;, counter: 2&lt;/tt&gt;, {upsert: true})}}&lt;/p&gt;

&lt;p&gt;{{&lt;/p&gt;
{ &quot;acknowledged&quot; : true, &quot;matchedCount&quot; : 1, &quot;modifiedCount&quot; : 1 }
&lt;p&gt;}}&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;//&lt;b&gt;QUERY 3&lt;/b&gt;: The filter matches initcaps _id and the $set tries to change lowercase _id to initcaps&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;&amp;gt; db.bugrepro.updateOne({_id: &quot;Nitin&quot;}, {$set: {_id: &quot;Nitin&quot;, counter: 3&lt;/tt&gt;, {upsert: true})}}&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;WriteError({ &quot;index&quot; : 0, &quot;code&quot; : 66, &quot;errmsg&quot; : &quot;Performing an update on the path &apos;_id&apos; would modify the immutable field &apos;_id&apos;&quot;,...})&lt;/tt&gt;&lt;/p&gt;</comment>
                            <comment id="3767881" author="eric.sedor" created="Tue, 11 May 2021 21:26:39 +0000"  >&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/create/#mongodb-dbcommand-dbcmd.create&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Collection-level collation&lt;/a&gt; informs default index and query collation arguments, which govern how indexes are created and how the queries that use them perform comparisons.&lt;/p&gt;

&lt;p&gt;But, collation doesn&apos;t impact the values stored in documents themselves. Changing the case of a value in a document (_id or not) is a real change, independent of how a document&apos;s index keys are collated, so I&apos;m not sure it makes sense for collation on an index on a field to change how errors are returned when updating. What do you think &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=nitin.katkam&quot; class=&quot;user-hover&quot; rel=&quot;nitin.katkam&quot;&gt;nitin.katkam&lt;/a&gt;?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </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>Tue, 11 May 2021 21:26:39 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 39 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>eric.sedor@mongodb.com</customfieldvalue>
            <customfieldvalue>nitin.katkam@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hz9xlr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hyupnr:</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_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>
                                    <customfieldvalue><![CDATA[eric.sedor@mongodb.com]]></customfieldvalue>
    

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hz9juv:</customfieldvalue>

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