<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:10:26 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>[CDRIVER-724] The index ensured by mongoc_client_get_gridfs must be unique</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-724</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;mongoc_client_get_gridfs() returns NULL in MongoDB versions &amp;lt; 3.0.&lt;/p&gt;

&lt;p&gt;Error message is:&lt;br/&gt;
files_id_1_n_1 already exists with different options&lt;/p&gt;

&lt;p&gt;When uploading files (e.g. using mongofiles), MongoDB creates an index with &lt;/p&gt;
{unique:1}
&lt;p&gt; in MongoDB 3.0, while it is missing in lower versions.&lt;/p&gt;

&lt;p&gt;What is the value of ensuring this index on each access anyway? MongoDB certainly creates the index. This is also a side-effect that should be documented.&lt;/p&gt;</description>
                <environment></environment>
        <key id="213376">CDRIVER-724</key>
            <summary>The index ensured by mongoc_client_get_gridfs must be unique</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="msoutier">Marius Soutier</reporter>
                        <labels>
                    </labels>
                <created>Fri, 26 Jun 2015 18:30:08 +0000</created>
                <updated>Wed, 3 May 2017 22:15:22 +0000</updated>
                            <resolved>Sun, 28 Jun 2015 22:19:52 +0000</resolved>
                                                                    <component>GridFS</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="953308" author="jesse" created="Mon, 29 Jun 2015 16:36:44 +0000"  >&lt;p&gt;Yes, sorry about that, you have to delete the non-unique index yourself. Until mongofiles is fixed you should &lt;b&gt;create&lt;/b&gt; the unique index, too, to prevent mongofiles from recreating the non-unique index.&lt;/p&gt;</comment>
                            <comment id="952829" author="msoutier" created="Mon, 29 Jun 2015 07:37:47 +0000"  >&lt;p&gt;So to summarize - if I&apos;m using mongofiles and I&apos;m using mongoc, I have to delete the faulty index myself? Or is there any other workaround?&lt;/p&gt;</comment>
                            <comment id="952701" author="jesse" created="Sun, 28 Jun 2015 22:19:52 +0000"  >&lt;p&gt;Thanks. Closing this works as designed, sorry - the upcoming GridFS spec doesn&apos;t tell drivers to attempt to replace a wrong index with a right one, and I doubt it would. It&apos;s a potentially very expensive operation with unforeseen consequences, should be left up to administrators to decide when to undertake it, not done automatically at unpredictable moment by the driver.&lt;/p&gt;</comment>
                            <comment id="952685" author="msoutier" created="Sun, 28 Jun 2015 20:03:38 +0000"  >&lt;p&gt;Done: &lt;a href=&quot;https://jira.mongodb.org/browse/TOOLS-808&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/TOOLS-808&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="952356" author="jesse" created="Fri, 26 Jun 2015 21:56:41 +0000"  >&lt;p&gt;Thanks. The &quot;chunks&quot; index should be unique. This may ultimately be a &lt;a href=&quot;https://github.com/go-mgo/mgo&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Go driver&lt;/a&gt; bug, but meanwhile would you mind opening a ticket here about the inconsistency in mongofiles and MongoDB 3 vs 2.6?:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/TOOLS&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/TOOLS&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="952334" author="msoutier" created="Fri, 26 Jun 2015 21:29:55 +0000"  >&lt;p&gt;It seems that mongofiles (latest version 3.0.4) will create a unique index on MongoDB 3.0, and a non-unique index on MongoDB 2.6.&lt;/p&gt;</comment>
                            <comment id="952327" author="jesse" created="Fri, 26 Jun 2015 21:24:57 +0000"  >&lt;p&gt;Oh I see, thanks. What about the latest version of mongofiles, does it create a unique index or no?&lt;/p&gt;</comment>
                            <comment id="952164" author="msoutier" created="Fri, 26 Jun 2015 19:05:22 +0000"  >&lt;p&gt;The C driver does indeed create the unique index. It&apos;s mongofiles that doesn&apos;t create the unique index (only a normal index) on earlier MongoDB versions. The driver should not fail but replace the non-unique index (which is my current workaround).&lt;/p&gt;</comment>
                            <comment id="952161" author="jesse" created="Fri, 26 Jun 2015 19:02:29 +0000"  >&lt;p&gt;Current draft spec for GridFS says: &quot;When a GridFSBucket object is created, drivers MUST ensure that the following indexes exist: a unique index on { files_id : 1, n : 1 } on the chunks collection. If this operation fails because the user is not authorized to create an index, GridFSBucket should recover and continue.&quot; What the spec calls a GridFSBucket is the C Driver&apos;s mongoc_gridfs_t. So the driver bug is that it creates a non-unique index instead of a unique one.&lt;/p&gt;

&lt;p&gt;Drivers are required to ensure certain indexes on the GridFS collections so that standard GridFS operations are performant. The MongoDB server doesn&apos;t create those indexes so drivers (and apparently mongofiles 3.0, now that it uses the Go driver).&lt;/p&gt;</comment>
                            <comment id="952143" author="jesse" created="Fri, 26 Jun 2015 18:48:12 +0000"  >&lt;p&gt;Hi, thanks for the clear report. We&apos;re finalizing a specification for how all MongoDB drivers ought to implement GridFS, I&apos;ll check with the spec author and see how we want to fix this.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="297835">TOOLS-1295</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="213600">TOOLS-808</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </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|hsaphb:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>