<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:05 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>[JAVA-790] Wrong type for option &apos;unique&apos; in GridFS constructor</title>
                <link>https://jira.mongodb.org/browse/JAVA-790</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;In the ctor of GridFS the following call on &lt;tt&gt;DBCollection#ensureIndex&lt;/tt&gt; sets a wrong value respectively the wrong type for option &quot;unique&quot;, so that the index will not be found even if it exists:&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;   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;_chunkCollection.ensureIndex( BasicDBObjectBuilder.start().add( &quot;files_id&quot; , 1 ).add( &quot;n&quot; , 1 ).get() , BasicDBObjectBuilder.start().add( &quot;unique&quot; , 1 ).get() );&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;The correct value would be &lt;tt&gt;true&lt;/tt&gt; instead of &lt;tt&gt;1&lt;/tt&gt;:&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;   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;_chunkCollection.ensureIndex( BasicDBObjectBuilder.start().add( &quot;files_id&quot; , 1 ).add( &quot;n&quot; , 1 ).get() , BasicDBObjectBuilder.start().add( &quot;unique&quot; , true ).get() );&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</description>
                <environment>using mongodb-linux-x86_64-2.4.0</environment>
        <key id="69403">JAVA-790</key>
            <summary>Wrong type for option &apos;unique&apos; in GridFS constructor</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="rre">Rainer Reich</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Mar 2013 14:27:04 +0000</created>
                <updated>Tue, 31 Mar 2015 20:09:55 +0000</updated>
                            <resolved>Thu, 22 Aug 2013 01:40:19 +0000</resolved>
                                    <version>2.10.1</version>
                                    <fixVersion>2.11.3</fixVersion>
                    <fixVersion>3.0.0</fixVersion>
                                    <component>GridFS</component>
                                        <votes>1</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="869465" author="jeff.yemin" created="Tue, 31 Mar 2015 20:09:55 +0000"  >&lt;p&gt;Closing all resolved 3.0.0 issues, as 3.0.0 has been tagged and released.&lt;/p&gt;</comment>
                            <comment id="423158" author="auto" created="Thu, 12 Sep 2013 01:54:21 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-790&quot; title=&quot;Wrong type for option &amp;#39;unique&amp;#39; in GridFS constructor&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-790&quot;&gt;&lt;del&gt;JAVA-790&lt;/del&gt;&lt;/a&gt;: Change index options from &lt;/p&gt;
{unique: 1}
&lt;p&gt; to &lt;/p&gt;
{unique : true}
&lt;p&gt;Branch: 2.11.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/9bb29e72afddc3639a5ff71c385f4142af8fcd39&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/9bb29e72afddc3639a5ff71c385f4142af8fcd39&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="408745" author="auto" created="Thu, 22 Aug 2013 01:39:40 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-790&quot; title=&quot;Wrong type for option &amp;#39;unique&amp;#39; in GridFS constructor&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-790&quot;&gt;&lt;del&gt;JAVA-790&lt;/del&gt;&lt;/a&gt;: Change index options from &lt;/p&gt;
{unique: 1}
&lt;p&gt; to &lt;/p&gt;
{unique : true}
&lt;p&gt;Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/5e98c07285817fcb4cc7ae76ddecc89857c0c6f9&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/5e98c07285817fcb4cc7ae76ddecc89857c0c6f9&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="405172" author="auto" created="Sat, 17 Aug 2013 03:02:06 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;trnl&apos;, u&apos;name&apos;: u&apos;Uladzimir Mihura&apos;, u&apos;email&apos;: u&apos;trnl.me@gmail.com&apos;}
&lt;p&gt;Message: fix(driver-compat) &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-790&quot; title=&quot;Wrong type for option &amp;#39;unique&amp;#39; in GridFS constructor&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-790&quot;&gt;&lt;del&gt;JAVA-790&lt;/del&gt;&lt;/a&gt;: wrap ensureIndex calls in GridFS into try-catch&lt;br/&gt;
Branch: 3.0.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/7de8c810afed408bd6f9f42cc5adafef4e161140&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/7de8c810afed408bd6f9f42cc5adafef4e161140&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="405168" author="uladzimir_mihura@epam.com" created="Sat, 17 Aug 2013 02:56:13 +0000"  >&lt;p&gt;So ok, it fixes a problem already.&lt;/p&gt;

&lt;p&gt;I&apos;ll update 3.x code.&lt;/p&gt;

&lt;p&gt;-vova&lt;/p&gt;</comment>
                            <comment id="405109" author="jeff.yemin" created="Sat, 17 Aug 2013 00:05:45 +0000"  >&lt;p&gt;In 2.11.2, the ensureIndex calls were put in a try-catch.  See &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-401&quot; title=&quot;&amp;quot;not master&amp;quot; MongoException when using GridFS with a direction connection to a secondary&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-401&quot;&gt;&lt;del&gt;JAVA-401&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="310185" author="sebastien.vauclair@elca.ch" created="Wed, 10 Apr 2013 12:51:52 +0000"  >&lt;p&gt;We encountered the same problem, for a slightly different reason: some of our servers are configured to access Mongo using a readonly user, which is therefore not allowed to create any index.&lt;/p&gt;

&lt;p&gt;We will use the same temporary workaround DB#setReadOnly() until a fix is released.&lt;/p&gt;</comment>
                            <comment id="296044" author="jeff.yemin" created="Fri, 22 Mar 2013 18:14:42 +0000"  >&lt;p&gt;OK, I see.  I can fix this in master and push a snapshot release to sonatype, but we don&apos;t have plans yet for another release (unless a major bug is found in 2.11.0).  Would you use a snapshot release?&lt;/p&gt;</comment>
                            <comment id="296016" author="rre" created="Fri, 22 Mar 2013 17:49:25 +0000"  >&lt;p&gt;I don&apos;t know if it&apos;s a performance issue. We have a pretty special setup, where we connect to a single Mongo node, not to a replica set. The problem is, that Mongo then tries to create an index and complains that it&apos;s not connected to the primary. Our temporary workaround is to use DB#setReadOnly() which prevents DBCollection#ensureIndex() from doing anything.&lt;/p&gt;</comment>
                            <comment id="295974" author="jeff.yemin" created="Fri, 22 Mar 2013 17:16:11 +0000"  >&lt;p&gt;Are you noticing any performance degradation as a result of this?  Note that the server will still ignore the index creation once it&apos;s been created the first time. &lt;/p&gt;</comment>
                            <comment id="295833" author="rre" created="Fri, 22 Mar 2013 14:49:10 +0000"  >&lt;p&gt;Well, ensureIndex ends up calling DBApiLayer#createIndex(...). There &lt;tt&gt;idxs.findOne(full)&lt;/tt&gt; returns null, because it does not find any document where key &lt;tt&gt;unique&lt;/tt&gt; has the value &lt;tt&gt;1&lt;/tt&gt;, because the value is really &lt;tt&gt;true&lt;/tt&gt;.&lt;br/&gt;
You can reproduce this in the mongo shell:&lt;br/&gt;
&apos;db.system.indexes.find(&lt;/p&gt;
{&quot;unique&quot;:1}
&lt;p&gt;)&apos; won&apos;t return anything, but&lt;br/&gt;
&apos;db.system.indexes.find(&lt;/p&gt;
{&quot;unique&quot;:true}
&lt;p&gt;)&apos; will return the index&lt;/p&gt;</comment>
                            <comment id="295825" author="jeff.yemin" created="Fri, 22 Mar 2013 14:38:46 +0000"  >&lt;p&gt;I&apos;m not sure what you mean.  Why won&apos;t it be found?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="20128">JAVA-401</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|hrmvgf:</customfieldvalue>

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