<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:33:56 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-14128] Creating _id index with unique:false should result in error</title>
                <link>https://jira.mongodb.org/browse/SERVER-14128</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When creating an index on an the _id with unique:false, the uniqueness is still enforced on it.&lt;/p&gt;

</description>
                <environment></environment>
        <key id="139528">SERVER-14128</key>
            <summary>Creating _id index with unique:false should result in error</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="rassi">J Rassi</assignee>
                                    <reporter username="levyavi">Avi Levy</reporter>
                        <labels>
                    </labels>
                <created>Mon, 2 Jun 2014 10:04:55 +0000</created>
                <updated>Mon, 11 Jul 2016 17:18:33 +0000</updated>
                            <resolved>Fri, 15 Aug 2014 14:57:54 +0000</resolved>
                                    <version>2.4.10</version>
                    <version>2.6.1</version>
                                    <fixVersion>2.7.5</fixVersion>
                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="691762" author="xgen-internal-githook" created="Fri, 15 Aug 2014 14:53:05 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jrassi&apos;, u&apos;name&apos;: u&apos;Jason Rassi&apos;, u&apos;email&apos;: u&apos;rassi@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-14128&quot; title=&quot;Creating _id index with unique:false should result in error&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-14128&quot;&gt;&lt;del&gt;SERVER-14128&lt;/del&gt;&lt;/a&gt; Disallow requests for non-unique _id indexes&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a1042b421b4a1f046a0228ef316c95f001a4781b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a1042b421b4a1f046a0228ef316c95f001a4781b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="609541" author="rassi@10gen.com" created="Thu, 5 Jun 2014 14:05:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=levyavi&quot; class=&quot;user-hover&quot; rel=&quot;levyavi&quot;&gt;levyavi&lt;/a&gt;: only non-compound indexes on _id have the property of forced uniqueness.&lt;/p&gt;</comment>
                            <comment id="609365" author="levyavi" created="Thu, 5 Jun 2014 11:01:07 +0000"  >&lt;p&gt;Just notice that When doing db.createCollection(&quot;bar&quot;, &lt;/p&gt;
{capped: false, autoIndexId: false}
&lt;p&gt; )  no index is created.&lt;br/&gt;
I can later create a compound index with _id and some other field&lt;br/&gt;
db.bar.ensureIndex({_id:1, dummy:1},&lt;/p&gt;
{unique:false}
&lt;p&gt;)&lt;br/&gt;
I can then insert duplicate ids.&lt;/p&gt;

</comment>
                            <comment id="605167" author="rassi@10gen.com" created="Mon, 2 Jun 2014 16:57:26 +0000"  >&lt;p&gt;Updating title to &quot;Creating _id index with unique:false should result in error&quot;.&lt;/p&gt;

&lt;p&gt;Assigning to &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=hari.khalsa%4010gen.com&quot; class=&quot;user-hover&quot; rel=&quot;hari.khalsa@10gen.com&quot;&gt;hari.khalsa@10gen.com&lt;/a&gt; for triage.&lt;/p&gt;</comment>
                            <comment id="604951" author="schwerin" created="Mon, 2 Jun 2014 14:30:41 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=levyavi&quot; class=&quot;user-hover&quot; rel=&quot;levyavi&quot;&gt;levyavi&lt;/a&gt;, replication depends on the uniqueness of the _id field, so I&apos;m inclined to consider this a reporting bug.  That is, the server should probably have returned an error to you when you attempted to create a non-unique index of _id.  Having collections without unique indexes on _id is extremely risky outside the &lt;tt&gt;local&lt;/tt&gt; database, both for correctness and performance of replication.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="62585">SERVER-8237</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="33302">SERVER-5335</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="151692">SERVER-14849</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 2 Jun 2014 13:43:57 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 26 weeks, 5 days ago
                        </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>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>levyavi</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>rassi</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrltzb:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>120307</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;// Create a on unique index&lt;/p&gt;

&lt;p&gt;use foo&lt;br/&gt;
db.createCollection(&quot;bar&quot;, &lt;/p&gt;
{capped: false, autoIndexId: false}
&lt;p&gt; )&lt;br/&gt;
db.bar.getIndexes()&lt;br/&gt;
// Should return [ ]&lt;br/&gt;
db.bar.ensureIndex({_id:1},&lt;/p&gt;
{unique:false}
&lt;p&gt;)&lt;br/&gt;
// index on _id will be returned&lt;br/&gt;
db.bar.getIndexes()&lt;br/&gt;
db.bar.insert(&lt;/p&gt;
{&quot;_id&quot; : 1}
&lt;p&gt;)&lt;br/&gt;
// The insert here will fail&lt;br/&gt;
db.bar.insert(&lt;/p&gt;
{&quot;_id&quot; : 1}
&lt;p&gt;)&lt;br/&gt;
db.dropDatabase()&lt;/p&gt;

&lt;p&gt;// now the same thing, only the index is not on the id&lt;/p&gt;

&lt;p&gt;use foo&lt;br/&gt;
db.createCollection(&quot;bar&quot;, &lt;/p&gt;
{capped: false, autoIndexId: false}
&lt;p&gt; )&lt;br/&gt;
db.bar.ensureIndex(&lt;/p&gt;
{hash:1}
&lt;p&gt;,&lt;/p&gt;
{unique:false}
&lt;p&gt;)&lt;br/&gt;
// index on hash will be returned&lt;br/&gt;
db.bar.getIndexes()&lt;br/&gt;
db.bar.insert(&lt;/p&gt;
{&quot;hash&quot; : 1}
&lt;p&gt;)&lt;br/&gt;
// The insert here will succeed&lt;br/&gt;
db.bar.insert(&lt;/p&gt;
{&quot;hash&quot; : 1}
&lt;p&gt;)&lt;br/&gt;
db.dropDatabase()&lt;/p&gt;

&lt;p&gt;// now the same thing without an index&lt;/p&gt;

&lt;p&gt;use foo&lt;br/&gt;
db.createCollection(&quot;bar&quot;, &lt;/p&gt;
{capped: false, autoIndexId: false}
&lt;p&gt; )&lt;br/&gt;
db.bar.insert(&lt;/p&gt;
{&quot;_id&quot; : 1}
&lt;p&gt;)&lt;br/&gt;
// The insert here will succeed&lt;br/&gt;
db.bar.insert(&lt;/p&gt;
{&quot;_id&quot; : 1}
&lt;p&gt;)&lt;br/&gt;
db.dropDatabase()&lt;/p&gt;</customfieldvalue>

                        </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|hsgvn3:</customfieldvalue>

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