<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:55:46 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-1000] $all with query optimizer</title>
                <link>https://jira.mongodb.org/browse/SERVER-1000</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Right now with an $all query we just look up the first field in the index.  We could instead try out all/some number of fields using the query optimizer.&lt;/p&gt;</description>
                <environment></environment>
        <key id="11761">SERVER-1000</key>
            <summary>$all with query optimizer</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="hari.khalsa@10gen.com">hari.khalsa@10gen.com</assignee>
                                    <reporter username="aaron">Aaron Staple</reporter>
                        <labels>
                    </labels>
                <created>Mon, 12 Apr 2010 15:38:31 +0000</created>
                <updated>Fri, 2 Mar 2018 18:57:16 +0000</updated>
                            <resolved>Fri, 20 Dec 2013 22:13:43 +0000</resolved>
                                                    <fixVersion>2.5.5</fixVersion>
                                    <component>Querying</component>
                                        <votes>44</votes>
                                    <watches>42</watches>
                                                                                                                <comments>
                            <comment id="473980" author="hari.khalsa@10gen.com" created="Fri, 20 Dec 2013 22:13:43 +0000"  >&lt;p&gt;We handle this via index intersection.&lt;/p&gt;</comment>
                            <comment id="321631" author="antoine" created="Thu, 25 Apr 2013 18:46:49 +0000"  >&lt;p&gt;Was just thinking about this: since we now have much faster count() operation on a clean range, why not use it to improve $all?&lt;br/&gt;
Mongo can first iterate over elements of $all and if it can make use of fast count then it should check which one returns fewer elements.&lt;br/&gt;
Most of the time matches in a $all are equalities on fields covered by index, so the optimization will be available.&lt;/p&gt;</comment>
                            <comment id="180276" author="auto" created="Mon, 29 Oct 2012 20:36:24 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-10-29T13:33:08-07:00&apos;, u&apos;name&apos;: u&apos;Sam Kleinman&apos;, u&apos;email&apos;: u&apos;samk@10gen.com&apos;}
&lt;p&gt;Message: merge: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1000&quot; title=&quot;$all with query optimizer&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1000&quot;&gt;&lt;del&gt;SERVER-1000&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/d5aa64d9ab19f10097255a3df7b4c07175641bb3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/d5aa64d9ab19f10097255a3df7b4c07175641bb3&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="180275" author="auto" created="Mon, 29 Oct 2012 20:36:22 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2012-10-26T03:27:48-07:00&apos;, u&apos;name&apos;: u&apos;giveturtle&apos;, u&apos;email&apos;: u&apos;yanir@giveable.co&apos;}
&lt;p&gt;Message: Added comment about $all&apos;s inefficiency&lt;/p&gt;

&lt;p&gt;See issue &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1000&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-1000&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/14fe6b73933026825d36b6699f987150b6b33214&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/14fe6b73933026825d36b6699f987150b6b33214&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="179516" author="disappointed" created="Fri, 26 Oct 2012 10:16:29 +0000"  >&lt;p&gt;Why isn&apos;t this bug part of the Mongo documentation? It&apos;s been known for over a year and a half, and since it&apos;s not documented I just assumed that doing $all queries on indexed fields would be fast because the most trivial way of implementing it is by doing index intersection.&lt;/p&gt;

&lt;p&gt;It would be better to mark $all as not implemented, because that&apos;s its current status. It&apos;s completely useless, as there are absolutely no guarantees it would ever finish (I mean ever in the web sense of user requests timing out).&lt;/p&gt;</comment>
                            <comment id="173248" author="sambomartin" created="Wed, 10 Oct 2012 09:12:53 +0000"  >&lt;p&gt;I&apos;ve done exactly that, works ok, until you want to search part of a term. &lt;br/&gt;
see &lt;a href=&quot;https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/xpUiCmsedPY&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/xpUiCmsedPY&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="52959" author="zelper" created="Thu, 8 Sep 2011 15:15:51 +0000"  >&lt;p&gt;So glad that someone has already raised this issue, that bother me for quiet a time.&lt;br/&gt;
I just planned to build my own tag dictionary holding the approximate counts.&lt;br/&gt;
Would this be in v2.1? &lt;/p&gt;</comment>
                            <comment id="29301" author="eliot" created="Tue, 19 Apr 2011 16:18:10 +0000"  >&lt;p&gt;We should really just do an index intersection&lt;/p&gt;</comment>
                            <comment id="25886" author="vicentemundim" created="Mon, 14 Mar 2011 20:18:15 +0000"  >&lt;p&gt;I also run into this issue. I have a collection of videos with a tags array attribute. Here is the output of a query using a tag which has lots of video and another one with just a few:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.videos.find({tags: {$all: &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;jornalismo&amp;#39;, &amp;#39;Atenas&amp;#39;&amp;#93;&lt;/span&gt;}}).explain()&lt;br/&gt;
{&lt;br/&gt;
&quot;cursor&quot; : &quot;BtreeCursor tags_1&quot;,&lt;br/&gt;
&quot;nscanned&quot; : 266996,&lt;br/&gt;
&quot;nscannedObjects&quot; : 266996,&lt;br/&gt;
&quot;n&quot; : 54,&lt;br/&gt;
&quot;millis&quot; : 4938,&lt;br/&gt;
&quot;indexBounds&quot; : {&lt;br/&gt;
&quot;tags&quot; : [&lt;br/&gt;
[&lt;br/&gt;
&quot;jornalismo&quot;,&lt;br/&gt;
&quot;jornalismo&quot;&lt;br/&gt;
]&lt;br/&gt;
]&lt;br/&gt;
}&lt;br/&gt;
}&lt;br/&gt;
&amp;gt; db.videos.find({tags: {$all: &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;Atenas&amp;#39;, &amp;#39;jornalismo&amp;#39;&amp;#93;&lt;/span&gt;}}).explain()&lt;br/&gt;
{&lt;br/&gt;
&quot;cursor&quot; : &quot;BtreeCursor tags_1&quot;,&lt;br/&gt;
&quot;nscanned&quot; : 94,&lt;br/&gt;
&quot;nscannedObjects&quot; : 94,&lt;br/&gt;
&quot;n&quot; : 54,&lt;br/&gt;
&quot;millis&quot; : 2,&lt;br/&gt;
&quot;indexBounds&quot; : {&lt;br/&gt;
&quot;tags&quot; : [&lt;br/&gt;
[&lt;br/&gt;
&quot;Atenas&quot;,&lt;br/&gt;
&quot;Atenas&quot;&lt;br/&gt;
]&lt;br/&gt;
]&lt;br/&gt;
}&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Here is the number of video documents for each tag:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.videos.find(&lt;/p&gt;
{tags: &apos;jornalismo&apos;}
&lt;p&gt;).count()&lt;br/&gt;
266996&lt;br/&gt;
&amp;gt; db.videos.find(&lt;/p&gt;
{tags: &apos;Atenas&apos;}
&lt;p&gt;).count()&lt;br/&gt;
94&lt;/p&gt;

&lt;p&gt;It uses only the first tag when searching through the indexes. It would be better if it used the tag with fewer documents, wouldn&apos;t?&lt;/p&gt;</comment>
                            <comment id="22503" author="mgoetzke" created="Wed, 19 Jan 2011 07:38:56 +0000"  >&lt;p&gt;this is basically where a statistics feature would come in handy. The statistics for this speficically might be gained from 10gen&apos;s efforts of implementing full-text search because the indices used there would give you a statistic for search term frequency.&lt;/p&gt;</comment>
                            <comment id="22500" author="gerad" created="Tue, 18 Jan 2011 21:56:21 +0000"  >&lt;p&gt;Just ran into this today.  It&apos;s especially annoying to code around because we don&apos;t know the cardinality of the terms when doing the query, but mongo does.&lt;/p&gt;

&lt;p&gt;&amp;gt; db.contacts.find({ search: &lt;/p&gt;
{ $all: [ &quot;chris&quot;, &quot;olsen&quot; ] }
&lt;p&gt; }).explain()&lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor search_1_&lt;em&gt;type_1_recent_connection_date&lt;/em&gt;-1&quot;,&lt;br/&gt;
	&quot;nscanned&quot; : 1378,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 1378,&lt;br/&gt;
	&quot;n&quot; : 6,&lt;br/&gt;
	&quot;millis&quot; : 722,&lt;br/&gt;
	&quot;indexBounds&quot; : { ...&lt;/p&gt;


&lt;p&gt;&amp;gt; db.contacts.find({ search: &lt;/p&gt;
{ $all: [ &quot;olsen&quot;, &quot;chris&quot; ] }
&lt;p&gt; }).explain()&lt;br/&gt;
{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor search_1_&lt;em&gt;type_1_recent_connection_date&lt;/em&gt;-1&quot;,&lt;br/&gt;
	&quot;nscanned&quot; : 32,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 32,&lt;br/&gt;
	&quot;n&quot; : 6,&lt;br/&gt;
	&quot;millis&quot; : 4,&lt;br/&gt;
	&quot;indexBounds&quot; : { ...&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="14865">SERVER-2617</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="33261">SERVER-5331</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="168131">SERVER-16042</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="16821">SERVER-3071</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>11.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 18 Jan 2011 21:56:21 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            10 years, 8 weeks, 5 days 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_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>aaron</customfieldvalue>
            <customfieldvalue>antoine</customfieldvalue>
            <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>disappointed</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>gerad</customfieldvalue>
            <customfieldvalue>hari.khalsa@10gen.com</customfieldvalue>
            <customfieldvalue>mgoetzke</customfieldvalue>
            <customfieldvalue>sambomartin</customfieldvalue>
            <customfieldvalue>vicentemundim</customfieldvalue>
            <customfieldvalue>zelper</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpnqv:</customfieldvalue>

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

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

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