<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:22:40 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>[DRIVERS-955] How should drivers report write concern error returned as part of a command error</title>
                <link>https://jira.mongodb.org/browse/DRIVERS-955</link>
                <project id="10980" key="DRIVERS">Drivers</project>
                    <description>&lt;p&gt;Typically, write concern errors are only be returned as part of the response to write commands, and in those cases the response will always be&#160;&lt;tt&gt;ok: 1&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;There are some other cases in which a write concern error can be returned outside of such a context, such as aggregate with &lt;tt&gt;$merge&lt;/tt&gt; (see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-44827&quot; title=&quot;Aggregate with $merge fails with command error, not write error&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-44827&quot;&gt;&lt;del&gt;SERVER-44827&lt;/del&gt;&lt;/a&gt;). In those cases, a write concern error can be included in both &lt;tt&gt;ok: 0&lt;/tt&gt;&#160;(i.e. command error) and &lt;tt&gt;ok: 1&lt;/tt&gt; responses. It is unclear how statically typed drivers (which have separate structures for &lt;tt&gt;WriteException&lt;/tt&gt; and &lt;tt&gt;CommandException&lt;/tt&gt;) are expected to handle this.&lt;/p&gt;

&lt;p&gt;A few options are possible:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;When encountering &lt;tt&gt;ok: 1&lt;/tt&gt; + WC error, throw a &lt;tt&gt;WriteException&lt;/tt&gt;. When encountering &lt;tt&gt;ok: 0&lt;/tt&gt; + WC error, discard the WC error and throw a &lt;tt&gt;CommandException&lt;/tt&gt;.&lt;/li&gt;
	&lt;li&gt;Amend &lt;tt&gt;CommandException&lt;/tt&gt; to have an option WC error field. Still throw &lt;tt&gt;WriteError&lt;/tt&gt; in the &lt;tt&gt;ok: 1&lt;/tt&gt; case.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I&apos;m not sure if either of these options are desirable though. Another more drastic solution would be to separate &lt;tt&gt;$out&lt;/tt&gt; and &lt;tt&gt;$merge&lt;/tt&gt; into their own helpers and advise users against using the stages directly in their own pipelines, similar to how we handle the &lt;tt&gt;$changeStream&lt;/tt&gt; stage. This would allow us to define more specific errors for these cases, but it may be too late in the game to start doing that (for &lt;tt&gt;$out&lt;/tt&gt; at least).&lt;/p&gt;</description>
                <environment></environment>
        <key id="1056999">DRIVERS-955</key>
            <summary>How should drivers report write concern error returned as part of a command error</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="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="patrick.freed@mongodb.com">Patrick Freed</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 Dec 2019 23:09:45 +0000</created>
                <updated>Thu, 31 Mar 2022 14:08:32 +0000</updated>
                                                                <component>CRUD</component>
                    <component>Read and Write Concern</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                    <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </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|hvwquf:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>