<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:42 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-623] Improve error code documentation</title>
                <link>https://jira.mongodb.org/browse/JAVA-623</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Currently there&apos;s no complete documentation of the error codes wrapped into MongoExceptions. There is &lt;a href=&quot;http://www.mongodb.org/display/DOCS/Error+Codes&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Error+Codes&lt;/a&gt; but that is self-entitled as highly incomplete and I&apos;ve repeatedly seen users seeing other error codes popping up. See &lt;a href=&quot;https://jira.springsource.org/browse/DATAMONGO-512&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://jira.springsource.org/browse/DATAMONGO-512&lt;/a&gt; for example (-5 seems to indicate an integrity violation).&lt;/p&gt;</description>
                <environment></environment>
        <key id="47307">JAVA-623</key>
            <summary>Improve error code documentation</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="oliver.gierke">Oliver Gierke</reporter>
                        <labels>
                            <label>documentation</label>
                            <label>error-codes</label>
                    </labels>
                <created>Thu, 16 Aug 2012 12:50:03 +0000</created>
                <updated>Fri, 8 Dec 2017 21:13:59 +0000</updated>
                            <resolved>Fri, 8 Dec 2017 21:13:59 +0000</resolved>
                                    <version>2.7.3</version>
                                                    <component>Documentation</component>
                                        <votes>1</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1747390" author="jeff.yemin" created="Fri, 8 Dec 2017 21:13:59 +0000"  >&lt;p&gt;The -5 error code was a weirdness of the 2.x driver and no longer exists in the 3.x driver.&lt;/p&gt;</comment>
                            <comment id="154838" author="jeff.yemin" created="Mon, 20 Aug 2012 13:01:52 +0000"  >&lt;p&gt;Unfortunately, it could appear in other scenarios if there is a server bug or some other situation where the server does not return an error code in the response.&lt;/p&gt;</comment>
                            <comment id="154834" author="oliver.gierke" created="Mon, 20 Aug 2012 12:35:07 +0000"  >&lt;p&gt;That&apos;s good news. Can I assume that error codes of -5 in server versions &amp;lt; 2.2.0 will always represent a data integrity violation? Or might this error code also appear in other scenarios? If the former is the case I could add appropriate handling to SD MongoDb for backwards compatibility.&lt;/p&gt;</comment>
                            <comment id="154832" author="jeff.yemin" created="Mon, 20 Aug 2012 12:25:46 +0000"  >&lt;p&gt;@Oliver, never mind about the test case.  I was using server version 2.2.0-rc1.  Testing with server version 2.0.7 I do get -5, which means this particular case is a server bug that will be fixed in 2.2.0.&lt;/p&gt;</comment>
                            <comment id="154826" author="jeff.yemin" created="Mon, 20 Aug 2012 12:18:57 +0000"  >&lt;p&gt;@Oliver, is there a test case that demonstrates a -5 error code with the E11000 error message?  In my tests I&apos;m getting an error code of 11000.&lt;/p&gt;

&lt;p&gt;Searching through the Java code, I do see -5 used as a catch-all error code when the server does not provide one.  See com.mongodb.ServerError#getCode.  It&apos;s also used in com.mongodb.MongoException.CursorNotFound#CursorNotFound, but that usage is not likely relevant here.&lt;/p&gt;

&lt;p&gt;I think the most we can do here without breaking compatibility is to document -5 as the error code that is returned for a server error where no error code has been provided by the server.  How does that sound?&lt;/p&gt;</comment>
                            <comment id="154803" author="oliver.gierke" created="Mon, 20 Aug 2012 10:10:41 +0000"  >&lt;p&gt;@Scott, Stephen - The original poster added a sample test case to &lt;a href=&quot;https://jira.springsource.org/browse/DATAMONGO-512&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://jira.springsource.org/browse/DATAMONGO-512&lt;/a&gt;. Indeed, although the exception message shows &lt;tt&gt;E11000&lt;/tt&gt; as you described, the call to &lt;tt&gt;CommandResult.getCode()&lt;/tt&gt; returns -5 which is not documented anywhere.&lt;/p&gt;

&lt;p&gt;As the general documentation seems to be covered in the tickets Stephen linked, shall we alter this ticket to capture the problem of an error code -5 being exposed rather than the expected &lt;tt&gt;E110000&lt;/tt&gt;. It seems this is something that could be fixed on the driver level actually.&lt;/p&gt;</comment>
                            <comment id="154778" author="oliver.gierke" created="Mon, 20 Aug 2012 07:38:47 +0000"  >&lt;p&gt;Awesome, thanks! &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="154145" author="stennie" created="Thu, 16 Aug 2012 21:00:06 +0000"  >&lt;p&gt;Hi Oliver,&lt;/p&gt;

&lt;p&gt;Thank you for the feedback.&lt;/p&gt;

&lt;p&gt;FYI, our documentation team is currently working on adding a more thorough server error code reference which will replace the limited info on the current wiki page.&lt;/p&gt;

&lt;p&gt;The related tracking issue is &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-335&quot; title=&quot;Error Message Reference&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-335&quot;&gt;&lt;del&gt;DOCS-335&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
Stephen&lt;/p&gt;</comment>
                            <comment id="153934" author="oliver.gierke" created="Thu, 16 Aug 2012 13:26:45 +0000"  >&lt;p&gt;In the linked ticket (DATAMONGO-512) the original poster claimed he got a &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;com.mongodb.CommandResult$CommandFailure and an errorcode &quot;-5&quot;.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;In general there&apos;s currently no resource documenting the error codes exposed completely.&lt;/p&gt;</comment>
                            <comment id="153926" author="scotthernandez" created="Thu, 16 Aug 2012 13:11:41 +0000"  >&lt;p&gt;I don&apos;t see -5 anywhere here, where did it come from:&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;org.springframework.data.mongodb.UncategorizedMongoDbException: command failed [command failed [findandmodify] { &quot;serverUsed&quot; : &quot;localhost:27017&quot; , &quot;lastErrorObject&quot; : { &quot;err&quot; : &quot;E11000 duplicate key error index: oneview.user.$foreignAccounts.TWITTER.foreignId_1 dup key: { : \&quot;100003485885211\&quot; }&quot; , &quot;code&quot; : 11001 , &quot;n&quot; : 0 , &quot;connectionId&quot; : 205 , &quot;ok&quot; : 1.0} ,...&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;Where did that come from? The error is returned from the server (lastErrorObject) and the java code just passes it through. We can probably map it better in findAndModify, or any command for that matter, for code:11001 to an IndexViolationException (which DuplicateKey should then derive from).&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="44163">DOCS-335</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></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|hrtvev:</customfieldvalue>

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