<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:20:46 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-4384] Hint option is undocumented and not validated for aggregate and countDocuments</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-4384</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;The &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#countdocuments&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;countDocuments&lt;/tt&gt;&lt;/a&gt; CRUD operation supports the same options as the deprecated &lt;tt&gt;count&lt;/tt&gt; operation. This includes &lt;tt&gt;hint&lt;/tt&gt;, although the implementation of &lt;tt&gt;countDocuments&lt;/tt&gt; means that it is provided to &lt;tt&gt;aggregate&lt;/tt&gt; instead of &lt;tt&gt;count&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Looking at the implementation of &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/1.21.1/src/libmongoc/src/mongoc/mongoc-collection.c#L1005&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;mongoc_collection_count_documents&lt;/tt&gt;&lt;/a&gt;, the &quot;skip&quot; and &quot;limit&quot; &lt;tt&gt;opts&lt;/tt&gt; are used to create the &lt;tt&gt;aggregate&lt;/tt&gt; command, and any other opts are passed as generic command options to &lt;tt&gt;mongoc_collection_read_command_with_opts&lt;/tt&gt;. This bypasses the options handling that might typically occur in &lt;tt&gt;_mongoc_aggregate_opts_parse&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;This apparently was not a problem for the &lt;tt&gt;comment&lt;/tt&gt; option (&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4199&quot; title=&quot;Add support for the comment field to all helpers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4199&quot;&gt;&lt;del&gt;CDRIVER-4199&lt;/del&gt;&lt;/a&gt;), which is provided as a &lt;tt&gt;bson_value_t&lt;/tt&gt;; however, I think it may be problematic for the &lt;tt&gt;hint&lt;/tt&gt; option as the functions will skip the typical validation we get through &lt;tt&gt;_mongoc_convert_hint&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Looking at this further, I realized that &lt;tt&gt;hint&lt;/tt&gt; is not even defined for &lt;tt&gt;mongoc_aggregate_opts_t&lt;/tt&gt; in &lt;tt&gt;generate-opts.py&lt;/tt&gt;, so the &lt;tt&gt;aggregate&lt;/tt&gt; operation is also missing documentation and validation.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2041529">CDRIVER-4384</key>
            <summary>Hint option is undocumented and not validated for aggregate and countDocuments</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="13201">Fixed</resolution>
                                        <assignee username="kevin.albertson@mongodb.com">Kevin Albertson</assignee>
                                    <reporter username="jmikola@mongodb.com">Jeremy Mikola</reporter>
                        <labels>
                            <label>neweng</label>
                    </labels>
                <created>Fri, 6 May 2022 19:19:25 +0000</created>
                <updated>Sat, 28 Oct 2023 11:28:06 +0000</updated>
                            <resolved>Fri, 12 May 2023 18:34:48 +0000</resolved>
                                                    <fixVersion>1.24.0</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="5421659" author="xgen-internal-githook" created="Fri, 12 May 2023 18:08:42 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Kevin Albertson&apos;, &apos;email&apos;: &apos;kevin.albertson@mongodb.com&apos;, &apos;username&apos;: &apos;kevinAlbs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4384&quot; title=&quot;Hint option is undocumented and not validated for aggregate and countDocuments&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4384&quot;&gt;&lt;del&gt;CDRIVER-4384&lt;/del&gt;&lt;/a&gt; document and validate `hint` option in `mongoc_collection_count_documents` and `mongoc_collection_aggregate`. (#1267)&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;document `hint` option in `mongoc_collection_count_documents`&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;validate hint in `mongoc_collection_count_documents`&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;add `hint` to `mongoc_aggregate_opts_t`&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;add failing tests for hint validation&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;document other options are passed to `aggregate` command&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;add `mongoc_count_document_opts_t`&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;use `mongoc_count_document_opts_t`&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;note rationale for bson_value_t&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;test maxTimeMS is appended&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/1cb8d11a385c53e0f40693d634fba6b87b0f5bd8&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/1cb8d11a385c53e0f40693d634fba6b87b0f5bd8&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2041531">DRIVERS-2320</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1903830">CDRIVER-4199</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_21553" key="com.atlassian.jira.plugin.system.customfieldtypes:labels">
                        <customfieldname>Quarter</customfieldname>
                        <customfieldvalues>
                                        <label>FY24Q2</label>
    
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0cx4w:</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>