<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:14:48 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-2296] Option to pass bson_validate_flags_t to update/insert functions</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-2296</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;There is currently no way of controlling what the insert/update functions check for when validating BSON documents prior to insert/update. For example, a client can not ask the validation function called by &lt;tt&gt;mongoc_collection_update()&lt;/tt&gt; to validate the BSON and tell it to allow empty keys. This can of course be worked around by explicitly calling &lt;tt&gt;bson_validate()&lt;/tt&gt; with the desired flags and then calling insert/update with &lt;tt&gt;MONGOC_INSERT/UPDATE_NO_VALIDATE&lt;/tt&gt; set, but that adds a little bit of complexity and some code clutter to client code. It would be handy to just be able to pass &lt;tt&gt;bson_validate_flags_t&lt;/tt&gt; to the insert/update calls.&lt;/p&gt;</description>
                <environment></environment>
        <key id="430899">CDRIVER-2296</key>
            <summary>Option to pass bson_validate_flags_t to update/insert 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="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="13201">Fixed</resolution>
                                        <assignee username="xiangyu.yao@mongodb.com">Xiangyu Yao</assignee>
                                    <reporter username="LarsLundstedt">Lars Lundstedt [X]</reporter>
                        <labels>
                    </labels>
                <created>Fri, 22 Sep 2017 13:14:52 +0000</created>
                <updated>Sat, 28 Oct 2023 11:30:26 +0000</updated>
                            <resolved>Tue, 12 Dec 2017 18:35:11 +0000</resolved>
                                                    <fixVersion>1.10.0</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1794096" author="xgen-internal-githook" created="Fri, 2 Feb 2018 22:52:53 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;jesse@mongodb.com&apos;, &apos;name&apos;: &apos;A. Jesse Jiryu Davis&apos;, &apos;username&apos;: &apos;ajdavis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2296&quot; title=&quot;Option to pass bson_validate_flags_t to update/insert functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2296&quot;&gt;&lt;del&gt;CDRIVER-2296&lt;/del&gt;&lt;/a&gt; fix &quot;validate&quot; options docs&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/6855c9b553e2255f008f17f44f794e89c46ed5c0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/6855c9b553e2255f008f17f44f794e89c46ed5c0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1749909" author="xgen-internal-githook" created="Tue, 12 Dec 2017 17:53:48 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Xiangyu Yao&apos;, &apos;email&apos;: &apos;xiangyu.yao24@gmail.com&apos;, &apos;username&apos;: &apos;xy24&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2296&quot; title=&quot;Option to pass bson_validate_flags_t to update/insert functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2296&quot;&gt;&lt;del&gt;CDRIVER-2296&lt;/del&gt;&lt;/a&gt; pass bson_validate_flags_t to update/insert functions via opt&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/48a9e73c2067514dad94afafc0f8659c32760b2d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/48a9e73c2067514dad94afafc0f8659c32760b2d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1747398" author="xiangyu.yao" created="Fri, 8 Dec 2017 21:19:00 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jesse&quot; class=&quot;user-hover&quot; rel=&quot;jesse&quot;&gt;jesse&lt;/a&gt; I think&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;allowNull: true, means the BSON_VALIDATE_UTF8_ALLOW_NULL bit is 0&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;should be&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;allowNull: true, means the BSON_VALIDATE_UTF8_ALLOW_NULL bit is 1&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Base on how we use it eventually: &lt;a href=&quot;https://github.com/mongodb/libbson/blob/1884989dad4110cc42f8355b88522fc544c0e294/src/bson/bson.c#L3233&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;link&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1725090" author="xgen-internal-githook" created="Tue, 14 Nov 2017 14:15:48 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;A. Jesse Jiryu Davis&apos;, &apos;username&apos;: &apos;ajdavis&apos;, &apos;email&apos;: &apos;jesse@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2296&quot; title=&quot;Option to pass bson_validate_flags_t to update/insert functions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2296&quot;&gt;&lt;del&gt;CDRIVER-2296&lt;/del&gt;&lt;/a&gt; CRUD functions take &quot;validate: false&quot;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/af1164d8d991499103943d86f92b75a147ea3209&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/af1164d8d991499103943d86f92b75a147ea3209&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1712099" author="jesse" created="Sun, 29 Oct 2017 18:23:57 +0000"  >&lt;p&gt;I&apos;m beginning this API for the new CRUD functions in 1.9.0. The functions are:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2331&quot; title=&quot;New &amp;quot;with_opts&amp;quot; functions to accept sessionId&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2331&quot;&gt;&lt;del&gt;CDRIVER-2331&lt;/del&gt;&lt;/a&gt;: mongoc_collection_insert_one, mongoc_collection_insert_many&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2205&quot; title=&quot;Array Update Improvements&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2205&quot;&gt;&lt;del&gt;CDRIVER-2205&lt;/del&gt;&lt;/a&gt;: mongoc_collection_update_one, mongoc_collection_update_many, mongoc_collection_replace_one&lt;/p&gt;

&lt;p&gt;These will now accept an option with field name &quot;validate&quot;. If its value is falsey according to bson_iter_as_bool (false, 0, null, ...) then no validation is performed. If it&apos;s exactly &quot;true&quot; then the driver does standard validation. Finer control (check UTF-8, allow NIL or &quot;$&quot; or &quot;.&quot; or empty keys) will be designed and implemented later.&lt;/p&gt;</comment>
                            <comment id="1707417" author="jesse" created="Tue, 24 Oct 2017 15:52:39 +0000"  >&lt;p&gt;We could define a way to pass validation options in a bson_t to all the new _with_opts functions, e.g. if you pass &lt;tt&gt;&apos;allowEmptyKeys&apos;: true&lt;/tt&gt; to mongoc_collection_insert_with_opts it&apos;ll allow empty keys.&lt;/p&gt;

&lt;p&gt;Update the validate functions in mongoc-util.c: _mongoc_validate_new_document, _mongoc_validate_replace, and _mongoc_validate_update.&lt;/p&gt;

&lt;p&gt;We need a function that converts from a bson_t *opts to a bson_validate_flags_t bit field, and uses that to override the default validate flags used by those three functions. Let&apos;s interpret fields in &quot;opts&quot; like so:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;validate: false, means all bits are 0&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Otherwise:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;allowEmptyKeys: true, means the BSON_VALIDATE_EMPTY_KEYS bit is 0&lt;/li&gt;
	&lt;li&gt;allowDollarKeys: true, means the BSON_VALIDATE_DOLLAR_KEYS bit is 0&lt;/li&gt;
	&lt;li&gt;allowNull: true, means the BSON_VALIDATE_UTF8_ALLOW_NULL bit is 0&lt;/li&gt;
	&lt;li&gt;allowDot: true, means the BSON_VALIDATE_DOT_KEYS bit is 0&lt;/li&gt;
	&lt;li&gt;validateUTF8: false, means the BSON_VALIDATE_UTF8 bit is 0&lt;/li&gt;
&lt;/ul&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="424368">CDRIVER-2265</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="449140">CDRIVER-2331</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="454284">CDRIVER-2340</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|ht76xz:</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>