<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:51:30 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-93] DBCollection.save() doesn&apos;t throw duplicate key exception</title>
                <link>https://jira.mongodb.org/browse/JAVA-93</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Steps to reproduce:&lt;br/&gt;
1) create unique index:&lt;br/&gt;
test.ensureIndex(new BasicDBObject(&quot;field&quot;, 1), &quot;fieldIndex&quot;, true);&lt;br/&gt;
2) save object &lt;/p&gt;
{field : 1, d : 1}
&lt;p&gt;3) save object &lt;/p&gt;
{field : 1, d : 2}
&lt;p&gt;Expected: exception on step 3&lt;br/&gt;
Detected: no exception. first object stored in DB.&lt;/p&gt;

&lt;p&gt;Unit test:&lt;br/&gt;
	@Test&lt;br/&gt;
	public void testUniqueViolation() throws UnknownHostException {&lt;br/&gt;
		Mongo mongo = new Mongo();&lt;br/&gt;
		mongo.dropDatabase(&quot;testdb&quot;);&lt;br/&gt;
		DB db = mongo.getDB(&quot;testdb&quot;);&lt;br/&gt;
		DBCollection test = db.getCollection(&quot;test&quot;);&lt;br/&gt;
		test.ensureIndex(new BasicDBObject(&quot;field&quot;, 1), &quot;fieldIndex&quot;, true);&lt;/p&gt;

&lt;p&gt;		test.save(new BasicDBObject(&quot;field&quot;, 1).append(&quot;discriminator&quot;, 1));&lt;br/&gt;
		try &lt;/p&gt;
{
			test.save(new BasicDBObject(&quot;field&quot;, 1).append(&quot;discriminator&quot;, 2));
			Assert.fail();
		}
&lt;p&gt; catch (MongoException e) {&lt;br/&gt;
		}&lt;br/&gt;
	}&lt;/p&gt;</description>
                <environment></environment>
        <key id="11539">JAVA-93</key>
            <summary>DBCollection.save() doesn&apos;t throw duplicate key exception</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="eliot">Eliot Horowitz</assignee>
                                    <reporter username="lifarv">Vladimir Lifar</reporter>
                        <labels>
                    </labels>
                <created>Wed, 17 Mar 2010 10:18:52 +0000</created>
                <updated>Wed, 17 Mar 2010 16:55:26 +0000</updated>
                            <resolved>Wed, 17 Mar 2010 10:23:26 +0000</resolved>
                                    <version>1.3</version>
                                    <fixVersion>1.3</fixVersion>
                                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="13084" author="lifarv" created="Wed, 17 Mar 2010 16:55:26 +0000"  >&lt;p&gt;Eilot,&lt;br/&gt;
thanks for reply. I&apos;d like to add some notes about these modes.&lt;br/&gt;
I&apos;ve found writeConcern property by a chance. It&apos;s not documented in Wiki and in JavaDocs. Some words about this property may help to other users of Mongo. &lt;br/&gt;
Also it looks strange for me that default mode is &apos;NORMAL&apos;. I suppose that DBMS is a kind of environment where errors are critical to user.&lt;/p&gt;</comment>
                            <comment id="13077" author="eliot" created="Wed, 17 Mar 2010 10:23:26 +0000"  >&lt;p&gt;if you want insert exception you have to turn on STRICT mode&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="10012"><![CDATA[Major Change]]></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|hrhd9j:</customfieldvalue>

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