<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:04:40 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-43981] Simple database query is taking over 10 mins even with a suitable index</title>
                <link>https://jira.mongodb.org/browse/SERVER-43981</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;We have a collection (called childData) with the following indexes:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;m_childDataCollection.CreateIndex(IndexKeys.Ascending(MongoChildData.ItemIdProperty).Ascending(MongoChildData.ChildIdProperty));&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;m_childDataCollection.CreateIndex(IndexKeys.Ascending(MongoChildData.RedundantTimeProperty));&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;This query runs very fast (less than a second) and returns 59631 :&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.childdata.find(\{ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }).count()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;This query takes around 15 minutes:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.childdata.find(\{ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }, \{ItemId : 1, ChId : 1}).toArray()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;We are failing to understand why this second query takes so long even though it is using the index?&lt;/p&gt;

&lt;p&gt;Please note that I have also rebuilt these indexes completely. It took over 3 days to do this!&lt;/p&gt;

&lt;p&gt;Thanks&lt;br/&gt;
Ian&lt;/p&gt;</description>
                <environment></environment>
        <key id="968166">SERVER-43981</key>
            <summary>Simple database query is taking over 10 mins even with a suitable index</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="daniel.hatcher@mongodb.com">Danny Hatcher</assignee>
                                    <reporter username="ihannah@meniscus.co.uk">Ian Hannah</reporter>
                        <labels>
                    </labels>
                <created>Sun, 13 Oct 2019 16:34:20 +0000</created>
                <updated>Tue, 5 Nov 2019 17:09:25 +0000</updated>
                            <resolved>Tue, 5 Nov 2019 17:09:25 +0000</resolved>
                                                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="2518321" author="daniel.hatcher" created="Tue, 5 Nov 2019 17:09:16 +0000"  >&lt;p&gt;I&apos;m glad you were able to figure it out!&lt;/p&gt;</comment>
                            <comment id="2512718" author="ihannah@meniscus.co.uk" created="Thu, 31 Oct 2019 15:53:53 +0000"  >&lt;p&gt;Hi Daniel,&lt;/p&gt;

&lt;p&gt;I spoke to a Mongo developer on Slack and it turns out that the index is not used unless the sort order is specified - this is critical when the find does not contain a query.&lt;/p&gt;

&lt;p&gt;This is my change:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;MongoCursor&amp;lt;MongoChildData&amp;gt; childCursor = childDataCollection.FindAll().SetSortOrder(SortBy.Ascending(MongoChildData.ItemIdProperty, MongoChildData.ChildIdProperty));&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; childCursor.SetFields(Fields.Exclude(MongoItem.IdProperty).Include(MongoChildData.ItemIdProperty, MongoChildData.ChildIdProperty));&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; childCursor.SetFlags(QueryFlags.NoCursorTimeout);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; childCursor.SetBatchSize(1000);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;and is very fast! You can close this issue now. Thanks for your help.&lt;/p&gt;</comment>
                            <comment id="2504915" author="daniel.hatcher" created="Mon, 28 Oct 2019 15:09:17 +0000"  >&lt;p&gt;I&apos;m unable to open the file you provided. It&apos;s possible there is something wrong with our JIRA system. Can you please reupload the explain for both the fast and slow queries to our &lt;a href=&quot;https://10gen-httpsupload.s3.amazonaws.com/upload_forms/c2b14d02-a0ea-48cf-942a-9e84a11a6589.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Secure Uploader&lt;/a&gt;?&lt;/p&gt;</comment>
                            <comment id="2501999" author="ihannah@meniscus.co.uk" created="Sat, 26 Oct 2019 06:46:27 +0000"  >&lt;p&gt;Hi Daniel. Have you had a chance to look at this yet?&lt;/p&gt;

&lt;p&gt;Just so that you can appreciate how slow this is we are using the C# driver to iterate over 2 million records like this:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;MongoCursor&amp;lt;MongoChildData&amp;gt; childCursor = childDataCollection.FindAll();&#160; &#160; &#160; &#160; &#160; &#160; &#160; childCursor.SetFields(Fields.Include(MongoChildData.ItemIdProperty, MongoChildData.ChildIdProperty));&#160; childCursor.SetFlags(QueryFlags.NoCursorTimeout);&#160; &#160; &#160; &#160; &#160; &#160; childCursor.SetBatchSize(&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&#160; &#160; &#160; &#160; &#160; &#160; &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;foreach (MongoChildData childData in childCursor)&#160; &#160; &#160; &#160; &#160; &#160; { &#160; &#160; }&#160; &#160;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;This code is taking days to run. There is an index on itemId and childId so how can this possibly take days to run?&lt;/p&gt;</comment>
                            <comment id="2495766" author="ihannah@meniscus.co.uk" created="Tue, 22 Oct 2019 17:36:13 +0000"  >&lt;p&gt;&lt;span class=&quot;nobr&quot;&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/attachment/234860/234860_find_with_itemId_ChId.txt&quot; title=&quot;find_with_itemId_ChId.txt attached to SERVER-43981&quot;&gt;find_with_itemId_ChId.txt&lt;sup&gt;&lt;img class=&quot;rendericon&quot; src=&quot;https://jira.mongodb.org/images/icons/link_attachment_7.gif&quot; height=&quot;7&quot; width=&quot;7&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/sup&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Attached out from the query returning itemId and ChId. It took some time to run!&lt;/p&gt;</comment>
                            <comment id="2493030" author="daniel.hatcher" created="Mon, 21 Oct 2019 17:27:00 +0000"  >&lt;p&gt;Most likely it is taking some time to run the query. If it still does not return after ~15 minutes, please provide the &lt;tt&gt;mongod&lt;/tt&gt; logs.&lt;/p&gt;</comment>
                            <comment id="2493021" author="ihannah@meniscus.co.uk" created="Mon, 21 Oct 2019 17:23:27 +0000"  >&lt;p&gt;Hi Daniel.&lt;/p&gt;

&lt;p&gt;I cannot get this to work:&lt;/p&gt;

&lt;p&gt;mongo -port 27057 -host 192.168.45.107 --authenticationDatabase &quot;admin&quot; -u &quot;menadmin&quot; -p &quot;&amp;lt;password&amp;gt;&quot; --eval &quot;db.getSiblingDB(&apos;map&apos;).childdata.explain(true).find({ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }, {ItemId : 1, ChId : 1})&quot;&lt;/p&gt;

&lt;p&gt;It seems to open the server and then lock up? See the attached screenshot.&lt;/p&gt;</comment>
                            <comment id="2492801" author="daniel.hatcher" created="Mon, 21 Oct 2019 15:54:36 +0000"  >&lt;p&gt;The count commands you are running are going against an empty namespace &quot;test.childdata&quot;. I assume that the collection name is correct but the database name is wrong. You can specify the specific database to query against in the command using &lt;tt&gt;.getSiblingDB()&lt;/tt&gt;:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongo -port 27057 -host 192.168.45.107 --authenticationDatabase &quot;admin&quot; -u &quot;menadmin&quot; -p &quot;&amp;lt;password&amp;gt;&quot; --eval &quot;db.getSiblingDB(&apos;&amp;lt;database&amp;gt;&apos;).childdata.explain(true).find({ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }, {ItemId : 1, ChId : 1})&quot;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Because the way the terminal interprets quotes, the quote type used for the database and the objectID should be the same.&lt;/p&gt;</comment>
                            <comment id="2492337" author="ihannah@meniscus.co.uk" created="Mon, 21 Oct 2019 12:48:07 +0000"  >&lt;p&gt;Hi Daniel. The output with the command without the toArray is attached.&lt;/p&gt;

&lt;p&gt;It shows that the estimated query time is 0. This just cannot be. Running the command takes a good few seconds to return the first page.&lt;/p&gt;

&lt;p&gt;In the driver I am trying to get all the matching rows into a list and this is taking 13-15 minutes. I assume that toArray will be just as slow. Why is the query so slow?&lt;/p&gt;

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

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2486676" author="daniel.hatcher" created="Thu, 17 Oct 2019 14:55:44 +0000"  >&lt;p&gt;Can you run the command with all the same options but without the toArray call? If the difference between the explain output provided previously and the new one is small, then the slowness will lie within the toArray.&lt;/p&gt;</comment>
                            <comment id="2486240" author="ihannah@meniscus.co.uk" created="Thu, 17 Oct 2019 07:25:04 +0000"  >&lt;p&gt;Hi Daniel. Can you please confirm how I should use the explain method with the toArray call? Once I know this I will send you the output.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Ian&lt;/p&gt;</comment>
                            <comment id="2483029" author="ihannah@meniscus.co.uk" created="Tue, 15 Oct 2019 15:29:29 +0000"  >&lt;p&gt;Output from the count() command attached.&lt;/p&gt;

&lt;p&gt;I cannot work out where to put the explain part in the toArray call:&lt;/p&gt;

&lt;p&gt;mongo -port 27057 -host 192.168.45.107 --authenticationDatabase &quot;admin&quot; -u &quot;menadmin&quot; -p &quot;&amp;lt;password&amp;gt;&quot; --eval &quot;db.childdata.find({ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }, {ItemId : 1, ChId : 1}).toArray().explain(true)&quot;&lt;/p&gt;

&lt;p&gt;Wherever I put it I get an error&lt;/p&gt;</comment>
                            <comment id="2482966" author="daniel.hatcher" created="Tue, 15 Oct 2019 15:05:32 +0000"  >&lt;p&gt;Both of the wrappers for the entire eval command the ObjectId use single quotes so it&apos;s matching them inappropriately. If you change either the eval quotes or the ObjectId quotes to be double quotes instead it should work. &lt;/p&gt;</comment>
                            <comment id="2482942" author="ihannah@meniscus.co.uk" created="Tue, 15 Oct 2019 14:57:44 +0000"  >&lt;p&gt;I am getting an error trying to run --eval (see attached picture). Any ideas?&lt;/p&gt;</comment>
                            <comment id="2482606" author="daniel.hatcher" created="Tue, 15 Oct 2019 14:17:58 +0000"  >&lt;blockquote&gt;
&lt;p&gt;What is the best way to get the output from the mongo shell into a file so that I can send you the information?&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;You can run shell commands directly from the terminal by using the &lt;a href=&quot;https://docs.mongodb.com/manual/tutorial/write-scripts-for-the-mongo-shell/index.html#eval-option&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;--eval option&lt;/a&gt;.&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// within the shell&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.foo.findOne()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// same command from terminal&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mongo --eval &apos;db.foo.findOne()&apos;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;As it returns to stdout, you can easily redirect the results to a file with &quot;&amp;gt;&quot;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Running this command:&lt;br/&gt;
db.childdata.find({ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }).count().explain(true)&lt;br/&gt;
does not work&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Unfortunately due to a &lt;a href=&quot;https://docs.mongodb.com/manual/reference/method/db.collection.explain/index.html#explain-mechanics&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;quirk in the &lt;tt&gt;mongo&lt;/tt&gt; shell&lt;/a&gt; explain only works at the end of some commands and &quot;count&quot; is not one of them. If you put the explain immediately after the collection, it will run correctly. For example:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.childdata.explain(true).find({ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }).count()&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;blockquote&gt;
&lt;p&gt;so I tried this:&lt;/p&gt;

&lt;p&gt;db.childdata.find({ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }).explain(true)&lt;br/&gt;
and this has not returned yet!&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The only possible issue I see is there is an escape character between &quot;find&quot; and &quot;ItemId&quot; but they may be an artifact of JIRA and not the actual command you ran. Can you please confirm?&lt;/p&gt;

&lt;p&gt;Given the data size you mention, it should return quickly. Can you please try some other simple queries against your data and see if any of them return explains?&lt;/p&gt;</comment>
                            <comment id="2482477" author="ihannah@meniscus.co.uk" created="Tue, 15 Oct 2019 13:06:31 +0000"  >&lt;p&gt;Running this command:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.childdata.find(\{ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }).count().explain(true)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;does not work so I tried this:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;db.childdata.find(\{ ItemId: ObjectId(&apos;596f322ba28f4b1240f1c2e9&apos;) }).explain(true)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;and this has not returned yet! Am I doing something wrong?&lt;/p&gt;</comment>
                            <comment id="2482237" author="ihannah@meniscus.co.uk" created="Tue, 15 Oct 2019 08:05:55 +0000"  >&lt;p&gt;Hi Daniel. What is the best way to get the output from the mongo shell into a file so that I can send you the information?&lt;/p&gt;</comment>
                            <comment id="2480783" author="daniel.hatcher" created="Mon, 14 Oct 2019 18:50:56 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ihannah%40meniscus.co.uk&quot; class=&quot;user-hover&quot; rel=&quot;ihannah@meniscus.co.uk&quot;&gt;ihannah@meniscus.co.uk&lt;/a&gt;, would you be able to connect to the instance via the &lt;tt&gt;mongo&lt;/tt&gt; shell, run both queries with &lt;a href=&quot;https://docs.mongodb.com/manual/reference/method/db.collection.explain/index.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;explain(true)&lt;/a&gt; and provide the output?&lt;/p&gt;</comment>
                            <comment id="2479304" author="ihannah@meniscus.co.uk" created="Sun, 13 Oct 2019 16:39:03 +0000"  >&lt;p&gt;Just to explain we are using the C# driver to get all the child ids for the specified item id. There are only 60000 so I would expect this to be fast.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="233765" name="countoutput.txt" size="1451" author="ihannah@meniscus.co.uk" created="Tue, 15 Oct 2019 15:28:10 +0000"/>
                            <attachment id="233758" name="error.png" size="25436" author="ihannah@meniscus.co.uk" created="Tue, 15 Oct 2019 14:57:21 +0000"/>
                            <attachment id="234860" name="find_with_itemId_ChId.txt" size="3392" author="ihannah@meniscus.co.uk" created="Tue, 22 Oct 2019 17:35:32 +0000"/>
                            <attachment id="234351" name="find_with_itemId_ChId.txt" size="1176" author="ihannah@meniscus.co.uk" created="Mon, 21 Oct 2019 12:42:03 +0000"/>
                            <attachment id="234394" name="screenshot.png" size="121742" author="ihannah@meniscus.co.uk" created="Mon, 21 Oct 2019 17:23:14 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>19.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 14 Oct 2019 18:50:56 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            4 years, 14 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>daniel.hatcher@mongodb.com</customfieldvalue>
            <customfieldvalue>ihannah@meniscus.co.uk</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hvx8xb:</customfieldvalue>

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

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

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