<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:53:50 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-61982] $merge changing structure of fields containing &apos;.&apos; in output collection</title>
                <link>https://jira.mongodb.org/browse/SERVER-61982</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When running an aggregation thats ends in $merge against any collection type the structure stored in the output collection for any field names containing a &apos;.&apos; is transformed to a nested objected resulting in a different format from the base collection.&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1946601">SERVER-61982</key>
            <summary>$merge changing structure of fields containing &apos;.&apos; in output collection</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-optimization">Backlog - Query Optimization</assignee>
                                    <reporter username="michael.gargiulo@mongodb.com">Michael Gargiulo</reporter>
                        <labels>
                            <label>query-product-1-3-3</label>
                    </labels>
                <created>Fri, 10 Dec 2021 15:50:20 +0000</created>
                <updated>Thu, 2 Nov 2023 18:28:26 +0000</updated>
                                                                            <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>17</watches>
                                                                                                                <comments>
                            <comment id="4294011" author="kateryna.kamenieva" created="Fri, 14 Jan 2022 19:41:46 +0000"  >&lt;p&gt;I think the result of the merge should have dotted field &apos;quantity.goods&apos; as it was in the original document&lt;/p&gt;</comment>
                            <comment id="4293937" author="kyle.suarez" created="Fri, 14 Jan 2022 19:11:17 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kateryna.kamenieva&quot; class=&quot;user-hover&quot; rel=&quot;kateryna.kamenieva&quot;&gt;kateryna.kamenieva&lt;/a&gt;, you were involved during the Dots and Dollars project &amp;#8211; do you have an opinion on what the right behavior should be here?&lt;/p&gt;</comment>
                            <comment id="4247458" author="michael.gargiulo" created="Tue, 14 Dec 2021 18:03:45 +0000"  >&lt;p&gt;An acceptable answer could also be to do nothing, but clearly document the behavior to not potentially break user expected behavior and/or scripts. I&apos;ll leave it up to &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=christopher.harris&quot; class=&quot;user-hover&quot; rel=&quot;christopher.harris&quot;&gt;christopher.harris&lt;/a&gt;&#160;&amp;amp; &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=kateryna.kamenieva&quot; class=&quot;user-hover&quot; rel=&quot;kateryna.kamenieva&quot;&gt;kateryna.kamenieva&lt;/a&gt;&#160;to make determinations on the expected behavior and what next steps should be&#160;&lt;/p&gt;</comment>
                            <comment id="4241165" author="asya" created="Fri, 10 Dec 2021 16:22:22 +0000"  >&lt;p&gt;This only happens when merging with existing documents, if (non-default) &lt;tt&gt;whenMatched:&quot;replace&quot;&lt;/tt&gt; is specified, the problem does not manifest since replace uses insert semantics.&lt;/p&gt;</comment>
                            <comment id="4241137" author="asya" created="Fri, 10 Dec 2021 16:14:08 +0000"  >&lt;p&gt;Note that this is not related to agg validating (or not) dotted fields - it&apos;s passing dotted field to update, but since there is no way to escape the &lt;tt&gt;.&lt;/tt&gt; it&apos;s resulting in &quot;incorrect&quot; document modification (from user POV).&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="4241128" author="asya" created="Fri, 10 Dec 2021 16:10:30 +0000"  >&lt;p&gt;This isn&apos;t really agg $merge as much as the fact that &lt;b&gt;update&lt;/b&gt; command cannot &lt;tt&gt;$set&lt;/tt&gt;&#160;dotted field names.&lt;/p&gt;

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

&lt;p&gt;Since &lt;tt&gt;$merge&lt;/tt&gt; uses update it causes setting of new field &lt;tt&gt;quantity&lt;/tt&gt; with subfield &lt;tt&gt;goods&lt;/tt&gt; instead of dotted field &lt;tt&gt;quantity.goods&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Note that $out does not have the same problem because it uses insert and not update under the covers.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="414602">SERVER-30575</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>6.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 10 Dec 2021 16:10:30 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 3 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<a href='https://jira.mongodb.org/browse/SERVER-30575'>SERVER-30575</a>]]></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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-878</customfieldvalue>
                        </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>dbeng-pm-bot</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 3 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>backlog-query-optimization</customfieldvalue>
            <customfieldvalue>kateryna.kamenieva@mongodb.com</customfieldvalue>
            <customfieldvalue>kyle.suarez@mongodb.com</customfieldvalue>
            <customfieldvalue>michael.gargiulo@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i0dwun:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2ix3:</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;ol&gt;
	&lt;li&gt;db.createCollection(&apos;mergeTest&apos;, {})&lt;/li&gt;
	&lt;li&gt;db.&apos;mergeTest&apos;.insertOne( { &quot;ts&quot; : ISODate(&quot;2021-11-19T09:27:44.001Z&quot;), &quot;sensorId&quot; : &quot;abc2c&quot;, &quot;quantity.goods&quot; : 2.0, &quot;price&quot; : 10.0, &quot;_id&quot; : ObjectId(&quot;619c63912dfeb5ace44e3c32&quot;) })&lt;/li&gt;
	&lt;li&gt;db.getCollection(&apos;mergeTest&apos;).aggregate(&lt;span class=&quot;error&quot;&gt;&amp;#91;\{$limit : 1}, \\{$merge : &amp;quot;testing1&amp;quot;}&amp;#93;&lt;/span&gt;)&lt;/li&gt;
	&lt;li&gt;db.getCollection(&apos;testing1&apos;).findOne({})&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;b&gt;Output Results:&lt;/b&gt;&#160;&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
 &quot;_id&quot;: ObjectId(&quot;619c63912dfeb5ace44e3c32&quot;),&lt;br/&gt;
 &quot;price&quot;: 10.0,&lt;br/&gt;
 &quot;quantity&quot;:&lt;/p&gt;

{ &quot;goods&quot;: 2.0 }

&lt;p&gt;,&lt;br/&gt;
 &quot;sensorId&quot;: &quot;abc2c&quot;,&lt;br/&gt;
 &quot;ts&quot;: ISODate(&quot;2021-11-19T09:27:44.001Z&quot;)&lt;br/&gt;
 }&lt;/p&gt;</customfieldvalue>

                        </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|i0dizz:</customfieldvalue>

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