<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:10:12 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>[DOCS-14361] Compound Sparse Unique indexes behaviour is not properly specified</title>
                <link>https://jira.mongodb.org/browse/DOCS-14361</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;h2&gt;&lt;a name=&quot;Description&quot;&gt;&lt;/a&gt;Description&lt;/h2&gt;
&lt;p&gt;The documentation is not complete for compound sparse unique index.&lt;/p&gt;

&lt;p&gt;Documentation mention if the key is omitted, then it won&apos;t trigger an error.&lt;/p&gt;

&lt;p&gt;But that&apos;s not true for compound indexes where one key (but not all) is omitted:&lt;/p&gt;

&lt;p&gt;```javascript&lt;br/&gt;
const &lt;/p&gt;
{ MongoClient }
&lt;p&gt; = require(&apos;mongodb&apos;);&lt;/p&gt;

&lt;p&gt;async function run() {&lt;br/&gt;
  const client = await MongoClient.connect(&lt;br/&gt;
    &apos;mongodb://127.0.0.1&apos;,&lt;br/&gt;
    &lt;/p&gt;
{
      useNewUrlParser: true,
      useUnifiedTopology: true,
    }
&lt;p&gt;,&lt;br/&gt;
  );&lt;/p&gt;

&lt;p&gt;  try {&lt;br/&gt;
    const db = await client.db(&apos;test&apos;);&lt;/p&gt;

&lt;p&gt;    await db.dropCollection(&apos;scores&apos;).catch(() =&amp;gt; &lt;/p&gt;
{ /* no-op */ });&lt;br/&gt;
    await db.dropCollection(&apos;scores-other&apos;).catch(() =&amp;gt; { /* no-op */ }
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;    await db.collection(&apos;scores&apos;).createIndex(&lt;br/&gt;
      &lt;/p&gt;
{ score: 1, attempt: 1 }
&lt;p&gt;,&lt;br/&gt;
      &lt;/p&gt;
{
        unique: true,
        sparse: true,
      }
&lt;p&gt;,&lt;br/&gt;
    );&lt;/p&gt;

&lt;p&gt;    // Works&lt;br/&gt;
    try {&lt;br/&gt;
      await db.collection(&apos;scores&apos;).insertOne(&lt;/p&gt;
{ userid: &apos;AAAAAAA&apos;, score: 43, attempt: 1 }
&lt;p&gt;);&lt;br/&gt;
      await db.collection(&apos;scores&apos;).insertOne(&lt;/p&gt;
{ userid: &apos;BBBBBBB&apos;, score: 34, attempt: 2 }
&lt;p&gt;);&lt;br/&gt;
    } catch (e) &lt;/p&gt;
{
      console.log(&apos;KO #1&apos;, e);
    }

&lt;p&gt;    try {&lt;br/&gt;
    // Works because key is omitted&lt;br/&gt;
      await db.collection(&apos;scores&apos;).insertOne(&lt;/p&gt;
{ userid: &apos;CCCCCCC&apos; }
&lt;p&gt;);&lt;br/&gt;
      await db.collection(&apos;scores&apos;).insertOne(&lt;/p&gt;
{ userid: &apos;DDDDDDD&apos; }
&lt;p&gt;);&lt;br/&gt;
    } catch (e) &lt;/p&gt;
{
      console.log(&apos;KO #2&apos;, e);
    }

&lt;p&gt;    try {&lt;br/&gt;
    // Not working: key is not considered as omited &lt;a href=&quot;https://docs.mongodb.com/manual/core/index-sparse/#sparse-and-unique-properties&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/manual/core/index-sparse/#sparse-and-unique-properties&lt;/a&gt;&lt;br/&gt;
      await db.collection(&apos;scores&apos;).insertOne(&lt;/p&gt;
{ userid: &apos;CCCCCCC&apos;, attempt: 1 }
&lt;p&gt;);&lt;br/&gt;
      await db.collection(&apos;scores&apos;).insertOne(&lt;/p&gt;
{ userid: &apos;DDDDDDD&apos;, attempt: 1 }
&lt;p&gt;);&lt;br/&gt;
    } catch (e) &lt;/p&gt;
{
      console.log(&apos;KO #3&apos;, e);
    }
&lt;p&gt;  } catch (err) &lt;/p&gt;
{
    console.error(err);
  }
&lt;p&gt; finally &lt;/p&gt;
{
    client.close();
  }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;run();&lt;br/&gt;
```&lt;/p&gt;

&lt;p&gt;I am not sure if this requires a documentation update or a bug fix.&lt;/p&gt;

&lt;h2&gt;&lt;a name=&quot;Scopeofchanges&quot;&gt;&lt;/a&gt;Scope of changes&lt;/h2&gt;

&lt;h2&gt;&lt;a name=&quot;ImpacttoOtherDocs&quot;&gt;&lt;/a&gt;Impact to Other Docs&lt;/h2&gt;

&lt;h2&gt;&lt;a name=&quot;MVP%28WorkandDate%29&quot;&gt;&lt;/a&gt;MVP (Work and Date)&lt;/h2&gt;

&lt;h2&gt;&lt;a name=&quot;Resources%28ScopeorDesignDocs%2CInvision%2Cetc.%29&quot;&gt;&lt;/a&gt;Resources (Scope or Design Docs, Invision, etc.)&lt;/h2&gt;
</description>
                <environment></environment>
        <key id="1680005">DOCS-14361</key>
            <summary>Compound Sparse Unique indexes behaviour is not properly specified</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="moroine.bentefrit@gmail.com">moroine bentefrit</reporter>
                        <labels>
                    </labels>
                <created>Wed, 14 Apr 2021 09:23:04 +0000</created>
                <updated>Mon, 30 Oct 2023 20:09:49 +0000</updated>
                                            <version>3.6.17</version>
                                    <fixVersion>Server_Docs_20231030</fixVersion>
                                    <component>manual</component>
                    <component>Server</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4940335" author="edu.bot" created="Mon, 31 Oct 2022 16:03:49 +0000"  >&lt;p&gt;Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 31 Oct 2022 16:03:49 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 14 weeks, 2 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>DOCSP-11701</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10040" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Estimate</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10041"><![CDATA[Extra Small]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>false</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>emet.ozar@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            1 year, 14 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>edu.bot</customfieldvalue>
            <customfieldvalue>moroine.bentefrit@gmail.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hz4rn3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hyprwv:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hz4dw7:</customfieldvalue>

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