<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:10:27 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-5992] system.indexes.find() from .js file doesn&apos;t work for me.</title>
                <link>https://jira.mongodb.org/browse/SERVER-5992</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Can you tell me why the following query.js doesn&apos;t work?  I would like to script our ability to list the indexes on a db.  &lt;br/&gt;
&amp;#8212;&lt;br/&gt;
rs.slaveOk();&lt;br/&gt;
printjson(db.getCollectionNames());    # this command works as expected&lt;br/&gt;
printjson(db.system.indexes.find());    # this command &lt;em&gt;doesn&apos;t&lt;/em&gt; list the indexes.  See below&lt;br/&gt;
&amp;#8211;&lt;/p&gt;

&lt;p&gt;The db.system.index.find() command works great from the interactive shell.  But what I get when using:&lt;/p&gt;

&lt;p&gt;mongo -u careverge -p secret careverge  ./query.js&lt;/p&gt;

&lt;p&gt;is&lt;/p&gt;

&lt;p&gt;MongoDB shell version: 2.0.1&lt;br/&gt;
connecting to: careverge&lt;br/&gt;
[&lt;br/&gt;
        &quot;Analytics&quot;,&lt;br/&gt;
        &quot;Campaign&quot;,&lt;br/&gt;
        &quot;EmailAnalytics&quot;,&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;snip&amp;#93;&lt;/span&gt;&lt;br/&gt;
]&lt;br/&gt;
{&lt;br/&gt;
        &quot;_mongo&quot; : connection to 127.0.0.1,&lt;br/&gt;
        &quot;_db&quot; : careverge,&lt;br/&gt;
        &quot;_collection&quot; : careverge.system.indexes,&lt;br/&gt;
        &quot;_ns&quot; : &quot;careverge.system.indexes&quot;,&lt;br/&gt;
        &quot;_query&quot; : {&lt;/p&gt;

&lt;p&gt;        },&lt;br/&gt;
        &quot;_fields&quot; : null,&lt;br/&gt;
        &quot;_limit&quot; : 0,&lt;br/&gt;
        &quot;_skip&quot; : 0,&lt;br/&gt;
        &quot;_batchSize&quot; : 0,&lt;br/&gt;
        &quot;_options&quot; : 0,&lt;br/&gt;
        &quot;_cursor&quot; : null,&lt;br/&gt;
        &quot;_numReturned&quot; : 0,&lt;br/&gt;
        &quot;_special&quot; : false,&lt;br/&gt;
        &quot;help&quot; : function () {&lt;br/&gt;
    print(&quot;find() modifiers&quot;);&lt;br/&gt;
    print(&quot;\t.sort( &lt;/p&gt;
{...}
&lt;p&gt; )&quot;);&lt;br/&gt;
    print(&quot;\t.limit( n )&quot;);&lt;br/&gt;
    print(&quot;\t.skip( n )&quot;);&lt;br/&gt;
    print(&quot;\t.count() - total # of objects matching query, ignores skip,limit&quot;);&lt;br/&gt;
    print(&quot;\t.size() - total # of objects cursor would return, honors skip,limit&quot;);&lt;br/&gt;
    print(&quot;\t.explain(&lt;span class=&quot;error&quot;&gt;&amp;#91;verbose&amp;#93;&lt;/span&gt;)&quot;);&lt;br/&gt;
    print(&quot;\t.hint(...)&quot;);&lt;br/&gt;
    print(&quot;\t.showDiskLoc() - adds a $diskLoc field to each returned object&quot;);&lt;br/&gt;
    print(&quot;\nCursor methods&quot;);&lt;br/&gt;
    print(&quot;\t.forEach( func )&quot;);&lt;br/&gt;
    print(&quot;\t.map( func )&quot;);&lt;br/&gt;
    print(&quot;\t.hasNext()&quot;);&lt;br/&gt;
    print(&quot;\t.next()&quot;);&lt;br/&gt;
},&lt;br/&gt;
        &quot;clone&quot; : function () {&lt;br/&gt;
    var q = new DBQuery(this._mongo, this._db, this._collection, this._ns, this._query, this._fields, this._limit, this._skip, this._batchSize, this._options);&lt;br/&gt;
    q._special = this._special;&lt;br/&gt;
    return q;&lt;br/&gt;
},&lt;br/&gt;
        &quot;_ensureSpecial&quot; : function () {&lt;br/&gt;
    if (this._special) &lt;/p&gt;
{
        return;
    }
&lt;p&gt;    var n = &lt;/p&gt;
{query:this._query}
&lt;p&gt;;&lt;br/&gt;
    this._query = n;&lt;br/&gt;
    this._special = true;&lt;br/&gt;
},&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;snip&amp;#93;&lt;/span&gt;&lt;br/&gt;
},&lt;br/&gt;
        &quot;toString&quot; : function () {&lt;br/&gt;
    return &quot;DBQuery: &quot; + this._ns + &quot; -&amp;gt; &quot; + tojson(this.query);&lt;br/&gt;
}&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;&amp;#8211;&lt;br/&gt;
Peter Burkholder | Cloud Engineer |  AudaxHealth&lt;br/&gt;
peter.burkholder@audaxhealth.com&lt;br/&gt;
M: +1-301-204-5767 | Skype: peter.burkholder-audax&lt;br/&gt;
3000 K Street NW, Suite 350 | Washington, DC 20007&lt;br/&gt;
@audaxhealth | @careverge |Visit us on Facebook - Audax Health | Careverge&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;For optimal efficiency, I check email at 2-hour intervals during the workday; during release weeks&lt;/li&gt;
	&lt;li&gt;I check more frequently.  Please use IM or phone for urgent matters&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="40206">SERVER-5992</key>
            <summary>system.indexes.find() from .js file doesn&apos;t work for me.</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="scotthernandez">Scott Hernandez</assignee>
                                    <reporter username="peter.burkholder@audaxhealth.com">Peter Burkholder</reporter>
                        <labels>
                    </labels>
                <created>Fri, 1 Jun 2012 19:35:33 +0000</created>
                <updated>Wed, 15 Aug 2012 14:24:18 +0000</updated>
                            <resolved>Fri, 1 Jun 2012 19:44:16 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="125239" author="scotthernandez" created="Fri, 1 Jun 2012 19:43:24 +0000"  >&lt;p&gt;Use toArray() as instead you get back the cursor object, not the results:&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;printjson(db.system.indexes.find().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;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 1 Jun 2012 19:43:24 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 37 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>peter.burkholder@audaxhealth.com</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hro14f:</customfieldvalue>

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

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

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