<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:28:17 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-12345] Validate write command documents in the server</title>
                <link>https://jira.mongodb.org/browse/SERVER-12345</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;It seems that you can currently insert cursor objects into mongo, which is a regression.&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;&amp;gt; var x = db.test.find()&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;&amp;gt; db.test.insert(x)&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;SingleWriteResult({&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;        &quot;writeErrors&quot; : [ ],&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;        &quot;writeConcernErrors&quot; : [ ],&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;        &quot;nInserted&quot; : 1,&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;        &quot;nUpserted&quot; : 0,&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;        &quot;nUpdated&quot; : 0,&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;        &quot;nModified&quot; : 0,&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;        &quot;nRemoved&quot; : 0,&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;        &quot;upserted&quot; : [ ]&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;})&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;When using write commands (default, when using shell against new mongod), input validation is going to be deferred to the server and is not yet fully implemented.&lt;/p&gt;</description>
                <environment></environment>
        <key id="105847">SERVER-12345</key>
            <summary>Validate write command documents in the server</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="andrew.emil@10gen.com">Andrew Emil</reporter>
                        <labels>
                    </labels>
                <created>Mon, 13 Jan 2014 19:12:13 +0000</created>
                <updated>Fri, 27 Oct 2023 19:34:45 +0000</updated>
                            <resolved>Mon, 13 Jan 2014 19:48:55 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="481547" author="alvin" created="Tue, 14 Jan 2014 04:58:49 +0000"  >&lt;p&gt;Looks like 2.4.8 shells prevents this&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Mon Jan 13 23:50:11.272 JavaScript execution failed: can&apos;t save a DBQuery object at src/mongo/shell/collection.js:L134&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;in 2.5.5-pre if you now run a find, you get the document + function definitions&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;gt; db.test.find()&lt;br/&gt;
{ &quot;_id&quot; : ObjectId(&quot;52d4c3c5be0411b0ddce2cf6&quot;), &quot;_mongo&quot; : { &quot;slaveOk&quot; : false, &quot;host&quot; : &quot;127.0.0.1:28000&quot;, &quot;authStatus&quot; : &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { &amp;quot;authRequired&amp;quot; }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;, &quot;_useWriteCommands&quot; : true }, &quot;_db&quot; : { &quot;_mongo&quot; : { &quot;slaveOk&quot; : false, &quot;host&quot; : &quot;127.0.0.1:28000&quot;, &quot;authStatus&quot; : &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { &amp;quot;authRequired&amp;quot; }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;, &quot;_useWriteCommands&quot; : true }, &quot;_name&quot; : &quot;test&quot; }, &quot;_collection&quot; : { &quot;_mongo&quot; : { &quot;slaveOk&quot; : false, &quot;host&quot; : &quot;127.0.0.1:28000&quot;, &quot;authStatus&quot; : &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { &amp;quot;authRequired&amp;quot; }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;, &quot;_useWriteCommands&quot; : true }, &quot;_db&quot; : { &quot;_mongo&quot; : { &quot;slaveOk&quot; : false, &quot;host&quot; : &quot;127.0.0.1:28000&quot;, &quot;authStatus&quot; : &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { &amp;quot;authRequired&amp;quot; }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;, &quot;_useWriteCommands&quot; : true }, &quot;_name&quot; : &quot;test&quot; }, &quot;_shortName&quot; : &quot;test&quot;, &quot;_fullName&quot; : &quot;test.test&quot;, &quot;_lastID&quot; : null }, &quot;_ns&quot; : &quot;test.test&quot;, &quot;_query&quot; : {  }, &quot;_fields&quot; : null, &quot;_limit&quot; : 0, &quot;_skip&quot; : 0, &quot;_batchSize&quot; : 0, &quot;_options&quot; : 0, &quot;_cursor&quot; : null, &quot;_numReturned&quot; : 0, &quot;_special&quot; : false, &quot;help&quot; : function () {&lt;br/&gt;
    print(&quot;find() modifiers&quot;)&lt;br/&gt;
    print(&quot;\t.sort( &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {...}&lt;/span&gt; &lt;/div&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(applySkipLimit) - total # of objects matching query. by default 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.addOption&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/thumbs_down.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; - adds op_query options &amp;#8211; see wire protocol&quot;)&lt;br/&gt;
    print(&quot;\t._addSpecial(name, value) - &lt;a href=&quot;http://dochub.mongodb.org/core/advancedqueries#AdvancedQueries-Metaqueryoperators&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://dochub.mongodb.org/core/advancedqueries#AdvancedQueries-Metaqueryoperators&lt;/a&gt;&quot;)&lt;br/&gt;
    print(&quot;\t.batchSize&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/thumbs_down.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; - sets the number of docs to return per getMore&quot;)&lt;br/&gt;
    print(&quot;\t.showDiskLoc() - adds a $diskLoc field to each returned object&quot;)&lt;br/&gt;
    print(&quot;\t.min(idxDoc)&quot;)&lt;br/&gt;
    print(&quot;\t.max(idxDoc)&quot;)&lt;br/&gt;
    print(&quot;\t.comment(comment)&quot;)&lt;br/&gt;
    print(&quot;\t.snapshot()&quot;)&lt;br/&gt;
    print(&quot;\t.readPref(mode, tagset)&quot;)&lt;/p&gt;

&lt;p&gt;    print(&quot;\nCursor methods&quot;);&lt;br/&gt;
    print(&quot;\t.toArray() - iterates through docs and returns an array of the results&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;
    print(&quot;\t.objsLeftInBatch() - returns count of docs left in current batch (when exhausted, a new getMore will be issued)&quot;)&lt;br/&gt;
    print(&quot;\t.itcount() - iterates through documents and counts them&quot;)&lt;br/&gt;
    print(&quot;\t.pretty() - pretty print each document, possibly over multiple lines&quot;)&lt;br/&gt;
}, &quot;clone&quot; : function (){&lt;br/&gt;
    var q =  new DBQuery( this._mongo , this._db , this._collection , this._ns ,&lt;br/&gt;
        this._query , this._fields ,&lt;br/&gt;
        this._limit , this._skip , this._batchSize , this._options );&lt;br/&gt;
    q._special = this._special;&lt;br/&gt;
    return q;&lt;br/&gt;
}, &quot;_ensureSpecial&quot; : function (){&lt;br/&gt;
    if ( this._special )&lt;br/&gt;
        return;&lt;/p&gt;

&lt;p&gt;    var n = &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { query }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;;&lt;br/&gt;
    this._query = n;&lt;br/&gt;
    this._special = true;&lt;br/&gt;
}, &quot;_checkModify&quot; : function (){&lt;br/&gt;
    if ( this._cursor )&lt;br/&gt;
        throw &quot;query already executed&quot;;&lt;br/&gt;
}, &quot;_exec&quot; : function (){&lt;br/&gt;
    if ( ! this._cursor )&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {        assert.eq( 0 , this._numReturned );        this._cursor = this._mongo.find( this._ns , this._query , this._fields , this._limit , this._skip , this._batchSize , this._options );        this._cursorSeen = 0;    }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;    return this._cursor;&lt;br/&gt;
}, &quot;limit&quot; : function ( limit ){&lt;br/&gt;
    this._checkModify();&lt;br/&gt;
    this._limit = limit;&lt;br/&gt;
    return this;&lt;br/&gt;
}, &quot;batchSize&quot; : function ( batchSize ){&lt;br/&gt;
    this._checkModify();&lt;br/&gt;
    this._batchSize = batchSize;&lt;br/&gt;
    return this;&lt;br/&gt;
}, &quot;addOption&quot; : function ( option ){&lt;br/&gt;
    this._options |= option;&lt;br/&gt;
    return this;&lt;br/&gt;
}, &quot;skip&quot; : function ( skip ){&lt;br/&gt;
    this._checkModify();&lt;br/&gt;
    this._skip = skip;&lt;br/&gt;
    return this;&lt;br/&gt;
}, &quot;hasNext&quot; : function (){&lt;br/&gt;
    this._exec();&lt;/p&gt;

&lt;p&gt;    if ( this._limit &amp;gt; 0 &amp;amp;&amp;amp; this._cursorSeen &amp;gt;= this._limit )&lt;br/&gt;
        return false;&lt;br/&gt;
    var o = this._cursor.hasNext();&lt;br/&gt;
    return o;&lt;br/&gt;
}, &quot;next&quot; : function (){&lt;br/&gt;
    this._exec();&lt;/p&gt;

&lt;p&gt;    var o = this._cursor.hasNext();&lt;br/&gt;
    if ( o )&lt;br/&gt;
        this._cursorSeen++;&lt;br/&gt;
    else&lt;br/&gt;
        throw &quot;error hasNext: &quot; + o;&lt;/p&gt;

&lt;p&gt;    var ret = this._cursor.next();&lt;br/&gt;
    if ( ret.$err )&lt;br/&gt;
        throw &quot;error: &quot; + tojson( ret );&lt;/p&gt;

&lt;p&gt;    this._numReturned++;&lt;br/&gt;
    return ret;&lt;br/&gt;
}, &quot;objsLeftInBatch&quot; : function (){&lt;br/&gt;
    this._exec();&lt;/p&gt;

&lt;p&gt;    var ret = this._cursor.objsLeftInBatch();&lt;br/&gt;
    if ( ret.$err )&lt;br/&gt;
        throw &quot;error: &quot; + tojson( ret );&lt;/p&gt;

&lt;p&gt;    return ret;&lt;br/&gt;
}, &quot;readOnly&quot; : function (){&lt;br/&gt;
    this._exec();&lt;br/&gt;
    this._cursor.readOnly();&lt;br/&gt;
    return this;&lt;br/&gt;
}, &quot;toArray&quot; : function (){&lt;br/&gt;
    if ( this._arr )&lt;br/&gt;
        return this._arr;&lt;/p&gt;

&lt;p&gt;    var a = [];&lt;br/&gt;
    while ( this.hasNext() )&lt;br/&gt;
        a.push( this.next() );&lt;br/&gt;
    this._arr = a;&lt;br/&gt;
    return a;&lt;br/&gt;
}, &quot;count&quot; : function ( applySkipLimit ) {&lt;br/&gt;
    var cmd = &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: { count}&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;;&lt;br/&gt;
    if ( this._query ) {&lt;br/&gt;
        if ( this._special ) {&lt;br/&gt;
            cmd.query = this._query.query;&lt;br/&gt;
            if ( this._query.$maxTimeMS ) &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {                cmd.$maxTimeMS = this._query.$maxTimeMS;            }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;        }&lt;br/&gt;
        else &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {            cmd.query = this._query;        }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;    }&lt;br/&gt;
    cmd.fields = this._fields || {};&lt;/p&gt;

&lt;p&gt;    if ( applySkipLimit ) &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {        if ( this._limit )            cmd.limit = this._limit;        if ( this._skip )            cmd.skip = this._skip;    }&lt;/span&gt; &lt;/div&gt;

&lt;p&gt;    var res = this._db.runCommand( cmd );&lt;br/&gt;
    if( res &amp;amp;&amp;amp; res.n != null ) return res.n;&lt;br/&gt;
    throw &quot;count failed: &quot; + tojson( res );&lt;br/&gt;
}, &quot;size&quot; : function (){&lt;br/&gt;
    return this.count( true );&lt;br/&gt;
}, &quot;countReturn&quot; : function (){&lt;br/&gt;
    var c = this.count();&lt;/p&gt;

&lt;p&gt;    if ( this._skip )&lt;br/&gt;
        c = c - this._skip;&lt;/p&gt;

&lt;p&gt;    if ( this._limit &amp;gt; 0 &amp;amp;&amp;amp; this._limit &amp;lt; c )&lt;br/&gt;
        return this._limit;&lt;/p&gt;

&lt;p&gt;    return c;&lt;br/&gt;
}, &quot;itcount&quot; : function (){&lt;br/&gt;
    var num = 0;&lt;br/&gt;
    while ( this.hasNext() )&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {        num++;        this.next();    }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;    return num;&lt;br/&gt;
}, &quot;length&quot; : function (){&lt;br/&gt;
    return this.toArray().length;&lt;br/&gt;
}, &quot;_addSpecial&quot; : function ( name , value ){&lt;br/&gt;
    this._ensureSpecial();&lt;br/&gt;
    this._query&lt;span class=&quot;error&quot;&gt;&amp;#91;name&amp;#93;&lt;/span&gt; = value;&lt;br/&gt;
    return this;&lt;br/&gt;
}, &quot;sort&quot; : function ( sortBy ){&lt;br/&gt;
    return this._addSpecial( &quot;orderby&quot; , sortBy );&lt;br/&gt;
}, &quot;hint&quot; : function ( hint ){&lt;br/&gt;
    return this._addSpecial( &quot;$hint&quot; , hint );&lt;br/&gt;
}, &quot;min&quot; : function ( min ) {&lt;br/&gt;
    return this._addSpecial( &quot;$min&quot; , min );&lt;br/&gt;
}, &quot;max&quot; : function ( max ) {&lt;br/&gt;
    return this._addSpecial( &quot;$max&quot; , max );&lt;br/&gt;
}, &quot;showDiskLoc&quot; : function () {&lt;br/&gt;
    return this._addSpecial( &quot;$showDiskLoc&quot; , true );&lt;br/&gt;
}, &quot;maxTimeMS&quot; : function ( maxTimeMS ) {&lt;br/&gt;
    return this._addSpecial( &quot;$maxTimeMS&quot; , maxTimeMS );&lt;br/&gt;
}, &quot;readPref&quot; : function ( mode, tagSet ) {&lt;br/&gt;
    var readPrefObj = &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {        mode}&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;;&lt;/p&gt;

&lt;p&gt;    if ( tagSet )&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {        readPrefObj.tags = tagSet;    }&lt;/span&gt; &lt;/div&gt;

&lt;p&gt;    return this._addSpecial( &quot;$readPreference&quot;, readPrefObj );&lt;br/&gt;
}, &quot;forEach&quot; : function ( func ){&lt;br/&gt;
    while ( this.hasNext() )&lt;br/&gt;
        func( this.next() );&lt;br/&gt;
}, &quot;map&quot; : function ( func ){&lt;br/&gt;
    var a = [];&lt;br/&gt;
    while ( this.hasNext() )&lt;br/&gt;
        a.push( func( this.next() ) );&lt;br/&gt;
    return a;&lt;br/&gt;
}, &quot;arrayAccess&quot; : function ( idx ){&lt;br/&gt;
    return this.toArray()&lt;span class=&quot;error&quot;&gt;&amp;#91;idx&amp;#93;&lt;/span&gt;;&lt;br/&gt;
}, &quot;comment&quot; : function (comment) {&lt;br/&gt;
    return this._addSpecial( &quot;$comment&quot; , comment );&lt;br/&gt;
}, &quot;explain&quot; : function (verbose) {&lt;br/&gt;
    /* verbose=true --&amp;gt; include allPlans, oldPlan fields */&lt;br/&gt;
    var n = this.clone();&lt;br/&gt;
    n._addSpecial( &quot;$explain&quot;, true );&lt;br/&gt;
    n._limit = Math.abs(n._limit) * -1;&lt;br/&gt;
    var e = n.next();&lt;/p&gt;

&lt;p&gt;    function cleanup(obj){&lt;br/&gt;
        if (typeof(obj) != &apos;object&apos;)&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {            return;        }&lt;/span&gt; &lt;/div&gt;

&lt;p&gt;        delete obj.allPlans;&lt;br/&gt;
        delete obj.oldPlan;&lt;/p&gt;

&lt;p&gt;        if (typeof(obj.length) == &apos;number&apos;){&lt;br/&gt;
            for (var i=0; i &amp;lt; obj.length; i++)&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {                cleanup(obj[i]);            }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;        }&lt;/p&gt;

&lt;p&gt;        if (obj.shards){&lt;br/&gt;
            for (var key in obj.shards)&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {                cleanup(obj.shards[key]);            }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;        }&lt;/p&gt;

&lt;p&gt;        if (obj.clauses)&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {            cleanup(obj.clauses);        }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;    }&lt;/p&gt;

&lt;p&gt;    if (!verbose)&lt;br/&gt;
        cleanup(e);&lt;/p&gt;

&lt;p&gt;    return e;&lt;br/&gt;
}, &quot;snapshot&quot; : function (){&lt;br/&gt;
    return this._addSpecial( &quot;$snapshot&quot; , true );&lt;br/&gt;
}, &quot;pretty&quot; : function (){&lt;br/&gt;
    this._prettyShell = true;&lt;br/&gt;
    return this;&lt;br/&gt;
}, &quot;shellPrint&quot; : function (){&lt;br/&gt;
    try {&lt;br/&gt;
        var start = new Date().getTime();&lt;br/&gt;
        var n = 0;&lt;br/&gt;
        while ( this.hasNext() &amp;amp;&amp;amp; n &amp;lt; DBQuery.shellBatchSize )&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {            var s = this._prettyShell ? tojson( this.next() ) }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;        if (typeof _verboseShell !== &apos;undefined&apos; &amp;amp;&amp;amp; _verboseShell) &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {            var time = new Date().getTime() - start;            print(&amp;quot;Fetched &amp;quot; + n + &amp;quot; record(s) in &amp;quot; + time + &amp;quot;ms&amp;quot;);        }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;         if ( this.hasNext() )&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {            print( &amp;quot;Type &amp;quot;it&amp;quot; for more&amp;quot; );            ___it___  = this;        }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;        else &lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {            ___it___  = null;        }&lt;/span&gt; &lt;/div&gt;
&lt;p&gt;   }&lt;br/&gt;
    catch ( e )&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {        print( e );    }&lt;/span&gt; &lt;/div&gt;

&lt;p&gt;}, &quot;toString&quot; : function ()&lt;/p&gt;
&lt;div class=&quot;error&quot;&gt;&lt;span class=&quot;error&quot;&gt;Unknown macro: {    return &amp;quot;DBQuery}&lt;/span&gt; &lt;/div&gt;
&lt;/blockquote&gt;</comment>
                            <comment id="481166" author="eliot" created="Mon, 13 Jan 2014 19:48:55 +0000"  >&lt;p&gt;The result has a tojson method, so you can insert it..&lt;br/&gt;
Doesn&apos;t seem like a bug.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2484687">SERVER-82524</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1698458">SERVER-56551</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </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>Mon, 13 Jan 2014 19:48:55 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 5 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>dbeng-pm-bot</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            10 years, 5 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>alvin</customfieldvalue>
            <customfieldvalue>andrew.emil@10gen.com</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrm42f:</customfieldvalue>

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

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

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