<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:25: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-2470] Extra write and write concern error fields may be inaccessible in modeled write results</title>
                <link>https://jira.mongodb.org/browse/DRIVERS-2470</link>
                <project id="10980" key="DRIVERS">Drivers</project>
                    <description>&lt;div class=&quot;panel&quot; style=&quot;background-color: #fafbfc;border-color: #21313c;border-style: solid;border-width: 1px;&quot;&gt;&lt;div class=&quot;panelContent&quot; style=&quot;background-color: #fafbfc;&quot;&gt;
&lt;h3&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;/h3&gt;
&lt;p&gt;DRIVERS-820 modified the CRUD spec to ensure a write error&apos;s &lt;tt&gt;errInfo&lt;/tt&gt; field was exposed as &lt;tt&gt;WriteError.details&lt;/tt&gt;. This was necessary to make document validation errors accessible to users.&lt;/p&gt;

&lt;p&gt;While working on &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS-2385&quot; title=&quot;Provide access to raw result document when the server returns an error for a command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DRIVERS-2385&quot;&gt;DRIVERS-2385&lt;/a&gt;, I noticed that duplicate key errors also provide additional information, which is currently not mapped in the CRUD spec. A write error document may include &lt;tt&gt;keyPattern&lt;/tt&gt; and &lt;tt&gt;keyValue&lt;/tt&gt; fields at the same level where we might find &lt;tt&gt;errInfo&lt;/tt&gt; for document validation. These particular fields are not essential, since the error message string does indicate the offending field and value.&lt;/p&gt;

&lt;p&gt;When examining libmongoc and PHPC, I noticed that those fields &lt;em&gt;are&lt;/em&gt; accessible in libmongoc since the entire bulk write result is an unmodeled BSON document; however, they become inaccessible in PHP since we use that document to construct BulkWriteException and WriteResult classes.&lt;/p&gt;

&lt;p&gt;This seems related to &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS-2385&quot; title=&quot;Provide access to raw result document when the server returns an error for a command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DRIVERS-2385&quot;&gt;DRIVERS-2385&lt;/a&gt; although it would not be directly addressed by that issue, since it pertains to command errors (write errors are included in &lt;tt&gt;ok:1&lt;/tt&gt; responses). In the spirit of &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS-2385&quot; title=&quot;Provide access to raw result document when the server returns an error for a command&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DRIVERS-2385&quot;&gt;DRIVERS-2385&lt;/a&gt;, I think drivers would do well to ensure the raw write error document (and perhaps write concern error) is accessible in any WriteResult model class. Ideally, the server could be consistent about using &lt;tt&gt;errInfo&lt;/tt&gt; &amp;#8211; it may be worthwhile to suggest this as a future change, but it&apos;s unlikely we&apos;d be able to alter behavior of existing releases.&lt;/p&gt;

&lt;p&gt;Note that the proposed solution here to expose the entire writeError and writeConcernError document within a WriteError and WriteConcernError model class, respectively, will provide an additional implementation to satisfy DRIVERS-820.&lt;/p&gt;

&lt;p&gt;This issue might also be addressed by the design of one-shot transactions and the new bulk API in &lt;a href=&quot;https://jira.mongodb.org/browse/DRIVERS-716&quot; title=&quot;Improved Bulk Write API&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DRIVERS-716&quot;&gt;DRIVERS-716&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Motivation&quot;&gt;&lt;/a&gt;&lt;b&gt;Motivation&lt;/b&gt;&lt;/h3&gt;
&lt;h4&gt;&lt;a name=&quot;Whoistheaffectedenduser%3F&quot;&gt;&lt;/a&gt;Who is the affected end user?&lt;/h4&gt;
&lt;p&gt;Users inspecting write errors.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Howdoesthisaffecttheenduser%3F&quot;&gt;&lt;/a&gt;How does this affect the end user?&lt;/h4&gt;
&lt;p&gt;Fields in server-side write and write concern errors may be inaccessible.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Howlikelyisitthatthisproblemorusecasewilloccur%3F&quot;&gt;&lt;/a&gt;How likely is it that this problem or use case will occur?&lt;/h4&gt;
&lt;p&gt;A known case is DuplicateKey(11000), which adds extra information about the offending key/value.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Iftheproblemdoesoccur%2Cwhataretheconsequencesandhowseverearethey%3F&quot;&gt;&lt;/a&gt;If the problem does occur, what are the consequences and how severe are they?&lt;/h4&gt;
&lt;p&gt;This is a minor concern for DuplicateKey(11000), since the error message includes the same information. We are not aware of other issues (noting that document validation was already addressed in DRIVERS-820).&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Isthisissueurgent%3F&quot;&gt;&lt;/a&gt;Is this issue urgent?&lt;/h4&gt;
&lt;p&gt;No.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Isthisticketrequiredbyadownstreamteam%3F&quot;&gt;&lt;/a&gt;Is this ticket required by a downstream team?&lt;/h4&gt;
&lt;p&gt;No.&lt;/p&gt;

&lt;h4&gt;&lt;a name=&quot;Isthisticketonlyfortests%3F&quot;&gt;&lt;/a&gt;Is this ticket only for tests?&lt;/h4&gt;
&lt;p&gt;No.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="2158177">DRIVERS-2470</key>
            <summary>Extra write and write concern error fields may be inaccessible in modeled write results</summary>
                <type id="14901" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14700&amp;avatarType=issuetype">Spec Change</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                    </labels>
                <created>Thu, 13 Oct 2022 04:47:32 +0000</created>
                <updated>Sat, 22 Oct 2022 13:04:47 +0000</updated>
                                                                <component>CRUD</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                    <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="900346">DRIVERS-716</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2086112">DRIVERS-2385</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </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_10951" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Driver Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10748"><![CDATA[Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0wkxs:</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>