<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:50:47 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-60808] mongodb3.4 upgrade 4.2, query plan isMultiKey attributes change</title>
                <link>https://jira.mongodb.org/browse/SERVER-60808</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;table like this:&#160;&lt;br/&gt;
&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://jira.mongodb.org/secure/attachment/341047/341047_image-2021-10-19-18-40-42-368.png&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;insert command:&lt;br/&gt;
db.getCollection(&quot;teachers&quot;).insert( &lt;/p&gt;
{
 _id: ObjectId(&quot;6124cd389c7200001a000cb9&quot;),
 name: &quot;jack&quot;,
 students: [
 1,
 2,
 3
 ]
}
&lt;p&gt; );&lt;br/&gt;
db.getCollection(&quot;teachers&quot;).insert( &lt;/p&gt;
{
 _id: ObjectId(&quot;616e9d3aad1100002b002009&quot;),
 name: &quot;marray&quot;,
 students: [ ]
}
&lt;p&gt; );&lt;/p&gt;

&lt;p&gt;*&lt;b&gt;In mongodb 4.2&lt;/b&gt;*&lt;br/&gt;
using index: &lt;br/&gt;
db.teachers.createIndex(&lt;/p&gt;
{
 &quot;students.0&quot;: 1
}
&lt;p&gt;, &lt;/p&gt;
{
 name: &quot;IX_first_student&quot;,
}
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;query: &lt;br/&gt;
db.teachers.find({&quot;students.0&quot;: 1}).explain();&lt;/p&gt;

&lt;p&gt;result:&lt;br/&gt;
{&lt;br/&gt;
 plannerVersion: NumberInt(&quot;1&quot;),&lt;br/&gt;
 namespace: &quot;myscrm_kktyadmin.teachers&quot;,&lt;br/&gt;
 indexFilterSet: false,&lt;br/&gt;
 parsedQuery: {&lt;br/&gt;
 &quot;students.0&quot;: &lt;/p&gt;
{
 $eq: 1
 }
&lt;p&gt; },&lt;br/&gt;
 queryHash: &quot;6ECDFB50&quot;,&lt;br/&gt;
 planCacheKey: &quot;88E51EB0&quot;,&lt;br/&gt;
 winningPlan: {&lt;br/&gt;
 stage: &quot;FETCH&quot;,&lt;br/&gt;
 inputStage: {&lt;br/&gt;
 stage: &quot;IXSCAN&quot;,&lt;br/&gt;
 keyPattern: &lt;/p&gt;
{
 &quot;students.0&quot;: 1
 }
&lt;p&gt;,&lt;br/&gt;
 indexName: &quot;IX_first_student&quot;,&lt;br/&gt;
 isMultiKey: true,&lt;br/&gt;
 multiKeyPaths: &lt;/p&gt;
{
 &quot;students.0&quot;: [
 &quot;students&quot;
 ]
 }
&lt;p&gt;,&lt;br/&gt;
 isUnique: false,&lt;br/&gt;
 isSparse: false,&lt;br/&gt;
 isPartial: false,&lt;br/&gt;
 indexVersion: NumberInt(&quot;2&quot;),&lt;br/&gt;
 direction: &quot;forward&quot;,&lt;br/&gt;
 indexBounds: &lt;/p&gt;
{
 &quot;students.0&quot;: [
 &quot;[1.0, 1.0]&quot;
 ]
 }
&lt;p&gt; }&lt;br/&gt;
 },&lt;br/&gt;
 rejectedPlans: [ ]&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;*&lt;b&gt;mongodb3.4&lt;/b&gt;*&lt;br/&gt;
using index: &lt;br/&gt;
db.teachers.createIndex(&lt;/p&gt;
{
 &quot;students.0&quot;: 1
}
&lt;p&gt;, &lt;/p&gt;
{
 name: &quot;IX_first_student&quot;,
}
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;query: &lt;br/&gt;
db.teachers.find({&quot;students.0&quot;: 1}).explain();&lt;/p&gt;

&lt;p&gt;result:&lt;br/&gt;
{&lt;br/&gt;
 plannerVersion: NumberInt(&quot;1&quot;),&lt;br/&gt;
 namespace: &quot;myscrm_kktyadmin.teachers&quot;,&lt;br/&gt;
 indexFilterSet: false,&lt;br/&gt;
 parsedQuery: {&lt;br/&gt;
 &quot;students.0&quot;: &lt;/p&gt;
{
 $eq: 1
 }
&lt;p&gt; },&lt;br/&gt;
 winningPlan: {&lt;br/&gt;
 stage: &quot;FETCH&quot;,&lt;br/&gt;
 inputStage: {&lt;br/&gt;
 stage: &quot;IXSCAN&quot;,&lt;br/&gt;
 keyPattern: &lt;/p&gt;
{
 &quot;students.0&quot;: 1
 }
&lt;p&gt;,&lt;br/&gt;
 indexName: &quot;IX_first_student&quot;,&lt;br/&gt;
 isMultiKey: false,&lt;br/&gt;
 multiKeyPaths: &lt;/p&gt;
{
 &quot;students.0&quot;: [ ]
 }
&lt;p&gt;,&lt;br/&gt;
 isUnique: false,&lt;br/&gt;
 isSparse: false,&lt;br/&gt;
 isPartial: false,&lt;br/&gt;
 indexVersion: NumberInt(&quot;2&quot;),&lt;br/&gt;
 direction: &quot;forward&quot;,&lt;br/&gt;
 indexBounds: &lt;/p&gt;
{
 &quot;students.0&quot;: [
 &quot;[1.0, 1.0]&quot;
 ]
 }
&lt;p&gt; }&lt;br/&gt;
 },&lt;br/&gt;
 rejectedPlans: [ ]&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;question is why in mongodb 4.2 isMultiKey is true?&lt;/p&gt;

&lt;p&gt;in mongodb 4.2, this behavior make some query can&apos;t hint index, plz help.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1902007">SERVER-60808</key>
            <summary>mongodb3.4 upgrade 4.2, query plan isMultiKey attributes change</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="13202">Works as Designed</resolution>
                                        <assignee username="edwin.zhou@mongodb.com">Edwin Zhou</assignee>
                                    <reporter username="jcs12311@gmail.com">&#26480;&#22478; &#26045;</reporter>
                        <labels>
                    </labels>
                <created>Tue, 19 Oct 2021 10:44:07 +0000</created>
                <updated>Fri, 27 Oct 2023 13:52:14 +0000</updated>
                            <resolved>Thu, 4 Nov 2021 21:32:21 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="4170502" author="JIRAUSER1257066" created="Thu, 4 Nov 2021 21:32:21 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jcs12311%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;jcs12311@gmail.com&quot;&gt;jcs12311@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for following up that creating an index with partialFilterExpression resolved this issue after upgrading from 3.4 to 4.2. A number of changes were made to indexing since MongoDB v3.2 and it&apos;s possible one of those changes may have affected what you see in the explain plan. If you&apos;re interested, you may be able to find some of the changes made &lt;a href=&quot;https://docs.mongodb.com/manual/release-notes/3.4-compatibility/#backwards-incompatible-features&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since you&apos;ve been able to work around this problem, I will now close this ticket.&lt;/p&gt;

&lt;p&gt;Best,&lt;br/&gt;
Edwin&lt;/p&gt;</comment>
                            <comment id="4148319" author="JIRAUSER1262953" created="Tue, 26 Oct 2021 14:26:42 +0000"  >&lt;p&gt;i using partialFilterExpression to createIndex, fix this problem&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="341047" name="image-2021-10-19-18-40-42-368.png" size="7739" author="jcs12311@gmail.com" created="Tue, 19 Oct 2021 10:40:43 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 4 Nov 2021 21:32:21 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 13 weeks, 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>
                            2 years, 13 weeks, 6 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>edwin.zhou@mongodb.com</customfieldvalue>
            <customfieldvalue>jcs12311@gmail.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i06cjz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hzpzpz:</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[edwin.zhou@mongodb.com]]></customfieldvalue>
    

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

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