<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:00 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-758] Write concern is behaving unexpectably</title>
                <link>https://jira.mongodb.org/browse/JAVA-758</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Hi,&lt;br/&gt;
I encounter strange behaviour regarding the writeResult.getN() returned value.&lt;/p&gt;

&lt;p&gt;The first save to a DBCollection seems to be failing, writeResult.getN() being != 1, but in fact, it does save the object, a subsequent find() proves it (see the attache test class, the method theTest).&lt;/p&gt;

&lt;p&gt;After a seemingly failled save, a second save actually return writeResult.getN() being == 1 (see theSecondTest).&lt;/p&gt;

&lt;p&gt;Did I do/understood something wrong?&lt;/p&gt;

&lt;p&gt;Thanks for your precious help!&lt;br/&gt;
Brice.&lt;/p&gt;</description>
                <environment>$ uname -a&lt;br/&gt;
Linux 3.5.0-24-generic #37-Ubuntu SMP Thu Feb 7 01:50:30 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux&lt;br/&gt;
$ mongo --version&lt;br/&gt;
MongoDB shell version: 2.0.6&lt;br/&gt;
$ mongod --version&lt;br/&gt;
db version v2.0.6, pdfile version 4.5&lt;br/&gt;
Tue Feb 12 18:53:04 git version: nogitversion&lt;br/&gt;
$ java -version&lt;br/&gt;
java version &amp;quot;1.7.0_13&amp;quot;&lt;br/&gt;
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)&lt;br/&gt;
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)&lt;br/&gt;
&lt;br/&gt;
</environment>
        <key id="64996">JAVA-758</key>
            <summary>Write concern is behaving unexpectably</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="-1">Unassigned</assignee>
                                    <reporter username="blaurencin@bestofmedia.com">Brice Laurencin</reporter>
                        <labels>
                            <label>driver</label>
                            <label>java</label>
                            <label>writeResult</label>
                    </labels>
                <created>Tue, 12 Feb 2013 18:01:51 +0000</created>
                <updated>Wed, 13 Feb 2013 15:24:53 +0000</updated>
                            <resolved>Wed, 13 Feb 2013 15:24:53 +0000</resolved>
                                    <version>2.9.3</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="265151" author="blaurencin@bestofmedia.com" created="Wed, 13 Feb 2013 15:07:28 +0000"  >&lt;p&gt;On this very test, it is an insert both times.&lt;/p&gt;

&lt;p&gt;Anyway, I worked arround this behavior, thanks for your time!&lt;br/&gt;
Brice.&lt;/p&gt;</comment>
                            <comment id="265123" author="jeff.yemin" created="Wed, 13 Feb 2013 14:41:01 +0000"  >&lt;p&gt;You can use that to determine whether the save call ended up inserting a new document or updating an existing one.  n = 0 is an insert, n = 1 is an update&lt;/p&gt;</comment>
                            <comment id="265107" author="blaurencin@bestofmedia.com" created="Wed, 13 Feb 2013 14:24:48 +0000"  >&lt;p&gt;Thanks for your quick reply!&lt;/p&gt;

&lt;p&gt;But then I don&apos;t get why the second call returns 1.&lt;/p&gt;</comment>
                            <comment id="264558" author="jeff.yemin" created="Tue, 12 Feb 2013 22:35:14 +0000"  >&lt;p&gt;I believe that n is not set on inserts, only updates and removes, since it&apos;s only then that you don&apos;t necessarily know how many documents were updated/removed.  If the insert/save failed, an exception will be thrown.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="24044" name="ExposingMongoStrangeBehavior.java" size="2985" author="blaurencin@bestofmedia.com" created="Tue, 12 Feb 2013 18:01:51 +0000"/>
                    </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|hrm4d3:</customfieldvalue>

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