<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:16:58 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-3031] Support options from mongoc_query_flags_t in aggregate helpers</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-3031</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;As discovered in &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2899&quot; title=&quot;Add a database aggregate helper&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2899&quot;&gt;&lt;del&gt;CDRIVER-2899&lt;/del&gt;&lt;/a&gt;, the flags passed into &lt;tt&gt;mongoc_collection_aggregate&lt;/tt&gt; are not applied properly.&lt;/p&gt;

&lt;p&gt;For example, the following snippet appends &lt;tt&gt;&quot;tailable&quot;: true&lt;/tt&gt; to the aggregate command, causing the server to respond with an error:&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;cursor = mongoc_collection_aggregate (&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;      collection,&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;      MONGOC_QUERY_TAILABLE_CURSOR,&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;      BCON_NEW(&quot;pipeline&quot;, &quot;[&quot;, &quot;]&quot;),&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;      NULL,  /* additional options */&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;      NULL); /* read prefs, NULL for default */&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;The tailable flag should only alter driver behavior for aggregation and not be sent as part of the aggregate or getMore commands.&lt;/p&gt;

&lt;p&gt;The logic leading up to appending the &quot;tailable&quot; field is as follows:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;We convert the TAILABLE flag to a &quot;tailable&quot; bson option &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/a3e3f079a1c5f04fbbe10ec54ce3ba30593a7bf1/src/libmongoc/src/mongoc/mongoc-cursor.c#L461&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Then copy those options to the cursor &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/master/src/libmongoc/src/mongoc/mongoc-cursor.c#L311&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; (and we don&apos;t exclude &quot;tailable&quot;)&lt;/li&gt;
	&lt;li&gt;And then we copy those back to the aggregate command &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/a3e3f079a1c5f04fbbe10ec54ce3ba30593a7bf1/src/libmongoc/src/mongoc/mongoc-cursor-cmd.c#L66&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;We should support &quot;tailable&quot; and &quot;awaitData&quot; in the aggregate helpers. It determines whether or not we send maxTimeMS to the getMore commands on that cursor &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/master/src/libmongoc/src/mongoc/mongoc-cursor.c#L1668-L1680&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;. And users may wish to specify the tailable option if creating a change stream with the helper. &lt;/p&gt;

&lt;p&gt;I have not checked all other flags aside from &quot;tailable&quot;, nor are they all applicable. For example SLAVE_OK is not applicable to &lt;tt&gt;mongoc_database_aggregate&lt;/tt&gt; since SLAVE_OK is only necessary for pre-OP_MSG servers, and database aggregation was introduced after OP_MSG.&lt;/p&gt;

&lt;p&gt;For &lt;tt&gt;mongoc_database_aggregate&lt;/tt&gt;, these options should only be passed through the &lt;tt&gt;bson_t&lt;/tt&gt; opts. For &lt;tt&gt;mongoc_collection_aggregate&lt;/tt&gt; they should be accepted as either flags or &lt;tt&gt;bson_t&lt;/tt&gt; opts, with perhaps the &lt;tt&gt;bson_t&lt;/tt&gt; opts overriding the flags.&lt;/p&gt;</description>
                <environment></environment>
        <key id="719890">CDRIVER-3031</key>
            <summary>Support options from mongoc_query_flags_t in aggregate helpers</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</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="kevin.albertson@mongodb.com">Kevin Albertson</reporter>
                        <labels>
                    </labels>
                <created>Wed, 20 Mar 2019 14:16:35 +0000</created>
                <updated>Thu, 31 Mar 2022 13:34:07 +0000</updated>
                                                                            <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="2385022" author="xgen-internal-githook" created="Fri, 23 Aug 2019 20:15:26 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;isabelatkinson&apos;, &apos;email&apos;: &apos;isabelatkinson@gmail.com&apos;, &apos;username&apos;: &apos;isabelatkinson&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-3031&quot; title=&quot;Support options from mongoc_query_flags_t in aggregate helpers&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-3031&quot;&gt;CDRIVER-3031&lt;/a&gt; support tailable flag in aggregate helper&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/b37f263e2286ad20c656df1e96fa106377fd7c7a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/b37f263e2286ad20c656df1e96fa106377fd7c7a&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="719895">CDRIVER-3032</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|htrnjb:</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>