<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:31:57 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-13509] locate mistake when using $ operation on arrays</title>
                <link>https://jira.mongodb.org/browse/SERVER-13509</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;For Example:&lt;br/&gt;
1,Create document which include two arrays that array &quot;b&quot; contain &quot;name&quot; attribute like &quot;a&quot;&lt;br/&gt;
db.test.insert(&lt;br/&gt;
{&lt;br/&gt;
&quot;a&quot;:[&lt;/p&gt;
{&quot;name&quot;:&quot;a&quot;,&quot;age&quot;:&quot;99&quot;}
&lt;p&gt;,&lt;/p&gt;
{&quot;name&quot;:&quot;b&quot;,&quot;age&quot;:&quot;99&quot;}
&lt;p&gt;],&lt;br/&gt;
&quot;b&quot;:[&lt;/p&gt;
{&quot;level&quot;:&quot;a&quot;,&quot;name&quot;:&quot;a&quot;,&quot;age&quot;:&quot;99&quot;}
&lt;p&gt;,&lt;/p&gt;
{&quot;level&quot;:&quot;b&quot;,&quot;name&quot;:&quot;b&quot;,&quot;age&quot;:&quot;99&quot;}
&lt;p&gt;]}&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;2,Update document which I want locate &lt;/p&gt;
{&quot;name&quot;:&quot;a&quot;,&quot;age&quot;:&quot;99&quot;}
&lt;p&gt; in &quot;a&quot; and &lt;/p&gt;
{&quot;level&quot;:&quot;b&quot;,&quot;name&quot;:&quot;b&quot;,&quot;age&quot;:&quot;99&quot;}
&lt;p&gt; in &quot;b&quot;&lt;br/&gt;
db.test.update(&lt;/p&gt;
{&quot;a.name&quot;:&quot;a&quot;,&quot;b.level&quot;:&quot;b&quot;}
&lt;p&gt;,&lt;br/&gt;
{&quot;$set&quot;:{&quot;a.$.age&quot;:&quot;100&quot;,&quot;b.$.age&quot;:&quot;100&quot;}}&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;But the result is:&lt;br/&gt;
{&quot;_id&quot;:ObjectId(&quot;53437c573de4c79e7ff69e91&quot;), &lt;br/&gt;
&quot;a&quot;:[&lt;/p&gt;
{&quot;name&quot;:&quot;a&quot;, &quot;age&quot;:&quot;99&quot; }
&lt;p&gt;, &lt;/p&gt;
{&quot;age&quot;:&quot;100&quot;,&quot;name&quot;:&quot;b&quot;}
&lt;p&gt;], &lt;br/&gt;
&quot;b&quot;:[&lt;/p&gt;
{&quot;level&quot;:&quot;a&quot;,&quot;name&quot;:&quot;a&quot;,&quot;age&quot;:&quot;99&quot;}
&lt;p&gt;, &lt;/p&gt;
{&quot;age&quot;:&quot;100&quot;,&quot;level&quot;:&quot;b&quot;,&quot;name&quot; :&quot;b&quot;}
&lt;p&gt;]&lt;br/&gt;
}&lt;br/&gt;
Updated the &quot;&lt;/p&gt;
{ &quot;age&quot; : &quot;100&quot;, &quot;name&quot; : &quot;b&quot; }
&lt;p&gt;&quot; in &quot;a&quot; like above ...&lt;/p&gt;</description>
                <environment></environment>
        <key id="129875">SERVER-13509</key>
            <summary>locate mistake when using $ operation on arrays</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="thomas.rueckstiess@mongodb.com">Thomas Rueckstiess</assignee>
                                    <reporter username="kimshen">KimShen</reporter>
                        <labels>
                    </labels>
                <created>Tue, 8 Apr 2014 04:49:06 +0000</created>
                <updated>Wed, 10 Dec 2014 23:12:03 +0000</updated>
                            <resolved>Tue, 8 Apr 2014 15:22:38 +0000</resolved>
                                                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="540843" author="kimshen" created="Tue, 8 Apr 2014 15:21:00 +0000"  >&lt;p&gt;Thanks a lot.  Please close this issue.&lt;/p&gt;</comment>
                            <comment id="540764" author="thomasr" created="Tue, 8 Apr 2014 14:34:09 +0000"  >&lt;p&gt;Hi, &lt;/p&gt;

&lt;p&gt;Our current implementation of the positional $ operator is documented here on our &lt;a href=&quot;http://docs.mongodb.org/manual/reference/operator/update/positional/#query&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;page on the $ query&lt;/a&gt;. The two relevant paragraphs are:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;the positional $ operator acts as a placeholder for the first element that matches the query document, and&lt;/p&gt;&lt;/blockquote&gt;

&lt;blockquote&gt;
&lt;p&gt;The positional $ operator cannot be used for queries which traverse more than one array, such as queries that traverse arrays nested within other arrays, because the replacement for the $ placeholder is a single value.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The &lt;tt&gt;$&lt;/tt&gt; sign is the index of the match in the first array, and it is a placeholder for a single value. So what you are trying to achieve is currently not possible with a single update and would require two updates, or rewriting the &lt;tt&gt;a&lt;/tt&gt; and &lt;tt&gt;b&lt;/tt&gt; arrays entirely as part of the update. &lt;/p&gt;

&lt;p&gt;A similar feature request to allow the positional operator for nested arrays is &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-831&quot; title=&quot;Positional Operator Matching Nested Arrays&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-831&quot;&gt;&lt;del&gt;SERVER-831&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Thomas&lt;/p&gt;</comment>
                            <comment id="540300" author="kimshen" created="Tue, 8 Apr 2014 05:44:15 +0000"  >&lt;p&gt;Add Example:&lt;br/&gt;
&amp;gt; db.test.findOne()&lt;br/&gt;
{&lt;br/&gt;
	&quot;_id&quot; : ObjectId(&quot;53438e4768b6db4ddf4f3ce3&quot;),&lt;br/&gt;
	&quot;a&quot; : [&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;name&quot; : &quot;a&quot;,
			&quot;age&quot; : &quot;aa&quot;
		}
&lt;p&gt;,&lt;/p&gt;
		{
			&quot;name&quot; : &quot;b&quot;,
			&quot;age&quot; : &quot;ab&quot;
		}
&lt;p&gt;	],&lt;br/&gt;
	&quot;b&quot; : [&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;level&quot; : &quot;a&quot;,
			&quot;age&quot; : &quot;ba&quot;
		}
&lt;p&gt;,&lt;/p&gt;
		{
			&quot;level&quot; : &quot;b&quot;,
			&quot;age&quot; : &quot;bb&quot;
		}
&lt;p&gt;	]&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Then update:&lt;br/&gt;
db.test.update(&lt;/p&gt;
{&quot;a.name&quot;:&quot;a&quot;,&quot;b.level&quot;:&quot;b&quot;}
&lt;p&gt;,{&quot;$set&quot;:{&quot;a.$.age&quot;:&quot;ax&quot;}})&lt;/p&gt;

&lt;p&gt;And result:&lt;br/&gt;
&amp;gt; db.test.findOne()&lt;br/&gt;
{&lt;br/&gt;
	&quot;_id&quot; : ObjectId(&quot;53438e4768b6db4ddf4f3ce3&quot;),&lt;br/&gt;
	&quot;a&quot; : [&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;name&quot; : &quot;a&quot;,
			&quot;age&quot; : &quot;aa&quot;
		}
&lt;p&gt;,&lt;/p&gt;
		{
			&quot;name&quot; : &quot;b&quot;,
			&quot;age&quot; : &quot;ax&quot;
		}
&lt;p&gt;	],&lt;br/&gt;
	&quot;b&quot; : [&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;level&quot; : &quot;a&quot;,
			&quot;age&quot; : &quot;ba&quot;
		}
&lt;p&gt;,&lt;/p&gt;
		{
			&quot;level&quot; : &quot;b&quot;,
			&quot;age&quot; : &quot;bb&quot;
		}
&lt;p&gt;	]&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;If want locate document using two query in two arrays then update , that&apos;s mistake&lt;/p&gt;</comment>
                            <comment id="540289" author="kimshen" created="Tue, 8 Apr 2014 05:29:40 +0000"  >&lt;p&gt;May be query for &quot;a&quot; locate &quot;array index 1&quot; and query for &quot;b&quot; locate &quot;array index 2&quot;,  that final location using &quot;b&quot; ?&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>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 8 Apr 2014 14:34:09 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 45 weeks, 1 day 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>
                            9 years, 45 weeks, 1 day 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>kimshen</customfieldvalue>
            <customfieldvalue>thomas.rueckstiess@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlx9z:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>111322</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>
                                

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

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