<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:36:57 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>[CSHARP-478] RunCommand(&quot;repairDatabase&quot;) throws an exception</title>
                <link>https://jira.mongodb.org/browse/CSHARP-478</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;The following command&lt;/p&gt;

&lt;p&gt;    database.RunCommand(&quot;repairDatabase&quot;)&lt;/p&gt;

&lt;p&gt;throws the exception:&lt;/p&gt;

&lt;p&gt;    Message=Command &apos;repairDatabase&apos; failed: bad option (response: &lt;/p&gt;
{ &quot;errmsg&quot; : &quot;bad option&quot;, &quot;ok&quot; : 0.0 }
&lt;p&gt;)&lt;br/&gt;
    Source=MongoDB.Driver&lt;br/&gt;
    StackTrace:&lt;br/&gt;
       at MongoDB.Driver.MongoDatabase.RunCommandAs(Type commandResultType, IMongoCommand command) in C:\Active\mongo-csharp-driver\Driver\Core\MongoDatabase.cs:line 981&lt;br/&gt;
       at MongoDB.Driver.MongoDatabase.RunCommandAs(Type commandResultType, String commandName) in C:\Active\mongo-csharp-driver\Driver\Core\MongoDatabase.cs:line 995&lt;br/&gt;
       at MongoDB.Driver.MongoDatabase.RunCommandAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TCommandResult&amp;#93;&lt;/span&gt;(String commandName) in C:\Active\mongo-csharp-driver\Driver\Core\MongoDatabase.cs:line 954&lt;br/&gt;
       at MongoDB.Driver.MongoDatabase.RunCommand(String commandName) in C:\Active\mongo-csharp-driver\Driver\Core\MongoDatabase.cs:line 930&lt;br/&gt;
       at Program.Main(String[] args) in c:\ROM\DEV\TryMongo\Program.cs:line 16&lt;/p&gt;

&lt;p&gt;Just a guess. If I use `1` instead of `true` in the C# driver code below then the command works.&lt;/p&gt;

&lt;p&gt;    MongoDatabase.RunCommandAs(Type commandResultType, string commandName)&lt;br/&gt;
    Driver\Core\MongoDatabase.cs(994):&lt;/p&gt;

&lt;p&gt;        var command = new CommandDocument(commandName, true); // guess: perhaps `1` should be used, not `true`&lt;/p&gt;

&lt;p&gt;At least, if we take a look at the definition of runCommand in the shell then we see that 1 is used:&lt;/p&gt;

&lt;p&gt;    &amp;gt; db.runCommand&lt;br/&gt;
    function (obj) {&lt;br/&gt;
        if (typeof obj == &quot;string&quot;) {&lt;br/&gt;
            var n = {};&lt;br/&gt;
            n&lt;span class=&quot;error&quot;&gt;&amp;#91;obj&amp;#93;&lt;/span&gt; = 1;&lt;br/&gt;
            obj = n;&lt;br/&gt;
        }&lt;br/&gt;
        return this.getCollection(&quot;$cmd&quot;).findOne(obj);&lt;br/&gt;
    }&lt;/p&gt;

&lt;p&gt;The full program code (very trivial) is attached.&lt;/p&gt;</description>
                <environment></environment>
        <key id="39773">CSHARP-478</key>
            <summary>RunCommand(&quot;repairDatabase&quot;) throws an exception</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="nightroman">Roman Kuzmin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 28 May 2012 21:45:10 +0000</created>
                <updated>Thu, 2 Apr 2015 18:27:37 +0000</updated>
                            <resolved>Wed, 6 Jun 2012 16:06:54 +0000</resolved>
                                    <version>1.4.2</version>
                                    <fixVersion>1.5</fixVersion>
                                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="127155" author="rstam" created="Wed, 6 Jun 2012 16:06:54 +0000"  >&lt;p&gt;Changed the default for commands to &lt;/p&gt;
{ commandName : 1 }
&lt;p&gt;.&lt;/p&gt;</comment>
                            <comment id="123729" author="rstam" created="Tue, 29 May 2012 02:30:14 +0000"  >&lt;p&gt;FYI, the Java driver uses true also instead of 1. There are very few commands that don&apos;t accept true.&lt;/p&gt;</comment>
                            <comment id="123727" author="rstam" created="Tue, 29 May 2012 02:17:44 +0000"  >&lt;p&gt;Yes, it probably would.&lt;/p&gt;

&lt;p&gt;Here&apos;s an easy workaround in the meantime:&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;var repairDatabaseCommand = new CommandDocument(&quot;repairDatabase&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;   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;database.RunCommand(repairDatabaseCommand);&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>
                            <comment id="123718" author="nightroman" created="Tue, 29 May 2012 00:58:02 +0000"  >&lt;p&gt;I see. But the shell uses 1. It makes sense perhaps to use 1 in the driver as well.&lt;/p&gt;</comment>
                            <comment id="123717" author="rstam" created="Tue, 29 May 2012 00:54:04 +0000"  >&lt;p&gt;Thanks for reporting this. The server normally accepts either 1 or true as the value of command names, but every now and then a command is picky and refuses one or the other.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="16870" name="Program.cs" size="320" author="nightroman" created="Mon, 28 May 2012 21:45:10 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrh7in:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14017</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>