<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:13:54 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>[CDRIVER-2017] Inconsistent error reporting for insert, update, and replace BSON validation</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-2017</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;The functions that append a write statement to the bulk (e.g. &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/1.6.0/src/mongoc/mongoc-bulk-operation.c#L297&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;mongoc_bulk_operation_insert()&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/1.6.0/src/mongoc/mongoc-bulk-operation.c#L373&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;mongoc_bulk_operation_replace_one()&lt;/tt&gt;&lt;/a&gt;) inconsistently handle error reporting.&lt;/p&gt;

&lt;p&gt;If we look at &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/1.6.0/src/mongoc/mongoc-bulk-operation.c#L297&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;mongoc_bulk_operation_insert()&lt;/tt&gt;&lt;/a&gt;, &lt;tt&gt;_mongoc_validate_new_document()&lt;/tt&gt; is only called if a document is being appended to a newly initialized insert command, and even then the validation function&apos;s boolean return value is ignored and a potentially invalid document is still added to the command. Validation is never performed at all before appending to an existing insert command (i.e. &lt;tt&gt;_mongoc_write_command_insert_append()&lt;/tt&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/1.6.0/src/mongoc/mongoc-bulk-operation.c#L373&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;mongoc_bulk_operation_replace_one()&lt;/tt&gt;&lt;/a&gt; delegates to &lt;tt&gt;_mongoc_bulk_operation_replace_one_with_opts()&lt;/tt&gt;, which starts with the following logic: &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;   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;if (bulk-&amp;gt;result.error.domain) {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;   /* already failed e.g. a bad call to mongoc_bulk_operation_insert */&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;   RETURN (true);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;}&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;This logic prevents a later &lt;tt&gt;_mongoc_validate_replace()&lt;/tt&gt; call from overwriting a previous error, which is good, but it effectively makes &lt;tt&gt;mongoc_bulk_operation_replace_one()&lt;/tt&gt; a NOP with no way to indicate that to the user. It would be better to return false if there is a pre-existing error. Also, the insert and update paths are missing equivalent logic (i.e. NOP on a pre-existing error) entirely, which means they may overwrite a previous error.&lt;/p&gt;</description>
                <environment></environment>
        <key id="351232">CDRIVER-2017</key>
            <summary>Inconsistent error reporting for insert, update, and replace BSON validation</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="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                    </labels>
                <created>Thu, 2 Feb 2017 15:41:45 +0000</created>
                <updated>Sat, 18 Feb 2017 01:51:08 +0000</updated>
                            <resolved>Sat, 18 Feb 2017 01:50:22 +0000</resolved>
                                    <version>1.6.0</version>
                                    <fixVersion>1.6.1</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1502873" author="xgen-internal-githook" created="Sat, 18 Feb 2017 01:51:08 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ajdavis&apos;, u&apos;name&apos;: u&apos;A. Jesse Jiryu Davis&apos;, u&apos;email&apos;: u&apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2017&quot; title=&quot;Inconsistent error reporting for insert, update, and replace BSON validation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2017&quot;&gt;&lt;del&gt;CDRIVER-2017&lt;/del&gt;&lt;/a&gt; fix bulk-op validation logic&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/4a0945f722d5c58ae5b5e25ac3d0860202729c3b&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/4a0945f722d5c58ae5b5e25ac3d0860202729c3b&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1490915" author="jmikola@gmail.com" created="Thu, 2 Feb 2017 15:45:23 +0000"  >&lt;p&gt;I realize that any new API would need to wait until 1.7.0. PHP may be able to work around the &lt;tt&gt;BulkWrite::insert()&lt;/tt&gt; issue of a deferred exception by validating the document ourselves. This duplicates validation, but would ensure that we can catch the error before libmongoc.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="351247">CDRIVER-2018</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="293706">PHPC-712</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="295884">CDRIVER-1341</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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsuk67:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1602">C Driver 2017 2 - Feb 10, 2019</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>