<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:45 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-763] MongoCommandException: Command &apos;filemd5&apos; failed</title>
                <link>https://jira.mongodb.org/browse/CSHARP-763</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;We are getting the following exception on replica set using GridFS. I read online about manually adding the index but shouldn&apos;t the C# driver automatically do so? How can we fix this?&lt;/p&gt;

&lt;p&gt;Exception: MongoDB.Driver.MongoCommandException: Command &apos;filemd5&apos; failed: need an &lt;br/&gt;
index on &lt;/p&gt;
{ files_id : 1 , n : 1 }
&lt;p&gt; (response: { &quot;errmsg&quot; : &quot;need an index on &lt;/p&gt;
{ files_id : 1 , n : 1 }
&lt;p&gt;&quot;, &quot;ok&quot; : 0.0 })&lt;/p&gt;</description>
                <environment></environment>
        <key id="80181">CSHARP-763</key>
            <summary>MongoCommandException: Command &apos;filemd5&apos; failed</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="1" iconUrl="https://jira.mongodb.org/images/icons/priorities/blocker.svg">Blocker - P1</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="majid.sameni@rms.com">Majid Sameni</reporter>
                        <labels>
                            <label>driver</label>
                    </labels>
                <created>Tue, 25 Jun 2013 00:10:24 +0000</created>
                <updated>Thu, 20 Mar 2014 16:39:20 +0000</updated>
                            <resolved>Thu, 27 Jun 2013 20:30:05 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="366934" author="rstam" created="Tue, 25 Jun 2013 01:09:00 +0000"  >&lt;p&gt;The driver uses EnsureIndex to create the indexes. Most drivers (the C# driver included) cache locally whether EnsureIndex has been called before or not, but they are unable to detect changes that happen outside of their control, as in dropping the database externally.&lt;/p&gt;

&lt;p&gt;Because of this most drivers are changing EnsureIndex to no longer cache whether it thinks the index already exists or not. See:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-736&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/CSHARP-736&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This change will be in the 1.9 version of the C# driver.&lt;/p&gt;

&lt;p&gt;Your workaround for now is to recreate the indexes manually after you drop the database.&lt;/p&gt;</comment>
                            <comment id="366931" author="majid.sameni@rms.com" created="Tue, 25 Jun 2013 01:02:36 +0000"  >&lt;p&gt;My colleague is saying that this happens when he drops the database when connected to master. I assume that drops the indexes as well but will the next upload automatically re-crate the database create the indexes?&lt;/p&gt;

&lt;p&gt;Exception: MongoDB.Driver.MongoCommandException: Command &apos;filemd5&apos; failed: need an index on &lt;/p&gt;
{ files_id : 1 , n : 1 }
&lt;p&gt; (response: { &quot;errmsg&quot; : &quot;need an index on &lt;/p&gt;
{ files_id : 1 , n : 1 }
&lt;p&gt;&quot;, &quot;ok&quot; : 0.0 })&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RunCommandAs(Type commandResultType, IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.MongoDatabase.RunCommandAs&lt;span class=&quot;error&quot;&gt;&amp;#91;TCommandResult&amp;#93;&lt;/span&gt;(IMongoCommand command)&lt;br/&gt;
   at MongoDB.Driver.GridFS.MongoGridFS.Upload(Stream stream, String remoteFileName, MongoGridFSCreateOptions createOptions)&lt;/p&gt;

&lt;p&gt;This is the code that is called on the next upload into the database that was deleted earlier on&lt;/p&gt;

&lt;p&gt;private MongoGridFS GetRiskStorageFS()&lt;/p&gt;
        {
            var mongoServer = MongoServer.Create(m_connectionString);

            var dbName = &quot;RiskStorage&quot;;

            var db = mongoServer.GetDatabase(dbName);

            var myFS = new MongoGridFS(db);
            
            return myFS;
        }

&lt;p&gt;Could this be because something is cached in the drive as the client code does not get reset on database drop.&lt;/p&gt;



</comment>
                            <comment id="366926" author="rstam" created="Tue, 25 Jun 2013 00:51:55 +0000"  >&lt;p&gt;Drivers usually create the required indexes automatically, as long as the following conditions are true:&lt;/p&gt;

&lt;p&gt;1. You are uploading a file (not downloading)&lt;br/&gt;
2. You are connected to the primary of the replica set&lt;br/&gt;
3. The fs.files collection does not already have more than 1000 files&lt;/p&gt;

&lt;p&gt;Can you provide a bit more information about your use case?&lt;/p&gt;

&lt;p&gt;A stack trace would be helpful also to determine exactly where in the driver the exception was thrown.&lt;/p&gt;

&lt;p&gt;Nothing in the driver would ever cause this index to be removed.&lt;/p&gt;

&lt;p&gt;If these indexes were inadvertently removed, you can recreate them using the MongoDB shell as follows:&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; use &amp;lt;yourdatabasename&amp;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;&amp;gt; db.fs.files.ensureIndex({ filename : 1, uploadDate : 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;&amp;gt; db.fs.chunks.ensureIndex({ files_id : 1, n : 1 })&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_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrrbqn:</customfieldvalue>

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