<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:20:32 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-4306] Inconsistencies between update, delete, and insert CRUD functions</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-4306</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;While implementing support for &lt;tt&gt;let&lt;/tt&gt; in &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4198&quot; title=&quot;Support &amp;#39;let&amp;#39; option for multiple CRUD commands&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4198&quot;&gt;&lt;del&gt;CDRIVER-4198&lt;/del&gt;&lt;/a&gt;, I realized that there are various differences to how &lt;tt&gt;_mongoc_collection_update_or_replace&lt;/tt&gt; and &lt;tt&gt;_mongoc_delete_one_or_many&lt;/tt&gt; are implemented. Both of those functions are the common helpers for their respective CRUD methods.&lt;/p&gt;

&lt;p&gt;A few, but not all, inconsistencies are as follows:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;_mongoc_delete_one_or_many&lt;/tt&gt; is missing the &quot;collection&quot; prefix found on the update/replace helper.&lt;/li&gt;
	&lt;li&gt;The &lt;tt&gt;delete_one&lt;/tt&gt; and &lt;tt&gt;delete_many&lt;/tt&gt; methods pass an initialized &lt;tt&gt;bson_t&lt;/tt&gt; as a &lt;tt&gt;limit&lt;/tt&gt; parameter, which is the used to append individual options for the delete statement and later passed as the &lt;tt&gt;opts&lt;/tt&gt; parameter &lt;tt&gt;_mongoc_write_command_init_delete_idl&lt;/tt&gt;. That document is later destroyed in the corresponding public CRUD method. In &lt;tt&gt;_mongoc_collection_update_or_replace&lt;/tt&gt;, the equivalent structure exists entirely within the helper method.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;_mongoc_delete_one_or_many&lt;/tt&gt; asserts that the incoming &lt;tt&gt;bson_t *reply&lt;/tt&gt; is empty or null. No such assertion is made in the update helper.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;_mongoc_collection_update_or_replace&lt;/tt&gt; checks that an explicit write concern is not being used within a transaction, while &lt;tt&gt;_mongoc_delete_one_or_many&lt;/tt&gt; has no such check.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;_mongoc_delete_one_or_many&lt;/tt&gt; receives &lt;tt&gt;extra&lt;/tt&gt; opts (from &lt;tt&gt;mongoc_delete_one_opts_t&lt;/tt&gt; and &lt;tt&gt;mongoc_delete_many_opts_t&lt;/tt&gt;) and passes those as the &lt;tt&gt;cmd_opts&lt;/tt&gt; parameter to &lt;tt&gt;_mongoc_write_command_init_delete_idl&lt;/tt&gt;. In &lt;tt&gt;_mongoc_collection_update_or_replace&lt;/tt&gt;, the &lt;tt&gt;extra&lt;/tt&gt; opts are used to append options for the update statement and later passed as the &lt;tt&gt;opts&lt;/tt&gt; parameter to &lt;tt&gt;_mongoc_write_command_init_update_idl&lt;/tt&gt; (akin to how the &lt;tt&gt;limit&lt;/tt&gt; document in the delete methods is used).&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Of these inconsistencies, I believe only the transaction error checking is relevant to users. The other issues seem mostly internal, but could improve maintainability if addressed. &lt;/p&gt;</description>
                <environment></environment>
        <key id="1998682">CDRIVER-4306</key>
            <summary>Inconsistencies between update, delete, and insert CRUD functions</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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>
                            <label>FY24Q4</label>
                            <label>neweng</label>
                            <label>rb-track</label>
                    </labels>
                <created>Thu, 10 Mar 2022 16:18:10 +0000</created>
                <updated>Tue, 28 Mar 2023 10:28:36 +0000</updated>
                                                                            <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4516825" author="jmikola@gmail.com" created="Fri, 29 Apr 2022 16:52:02 +0000"  >&lt;p&gt;Modifying the issue description as I also noticed the &lt;tt&gt;insert_one&lt;/tt&gt; and &lt;tt&gt;insert_many&lt;/tt&gt; methods also handle &lt;tt&gt;extra&lt;/tt&gt; options and pass them along to &lt;tt&gt;_mongoc_write_command_init_insert_idl&lt;/tt&gt; as &lt;tt&gt;cmd_opts&lt;/tt&gt;.&lt;/p&gt;</comment>
                    </comments>
                    <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|i05sos:</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>