<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:58:28 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>[JAVA-2965] maxAwaitTime not working on a change stream</title>
                <link>https://jira.mongodb.org/browse/JAVA-2965</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I&apos;m using the java driver version 3.8.0 and mongodb 3.6.&lt;/p&gt;

&lt;p&gt;The documentation &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/change-streams/change-streams.rst&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; states about maxAwaitTime:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;font color=&quot;#333333&quot;&gt;The maximum amount of time for the server to wait on new documents to satisfy a change stream query.&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;However, what I&apos;m seeing is that cursor.hasNext() returns only if there is a change on the collection, never when the time passed to maxAwaitTime has elapsed.&lt;/p&gt;

&lt;p&gt;When I turn on mongodb&apos;s verbose logging I see maxWaitTime set as expected in the getMore command.&lt;/p&gt;

&lt;p&gt;Is maxAwaitTime supposed to cause my watch to timeout when there are no changes?&lt;/p&gt;</description>
                <environment></environment>
        <key id="601724">JAVA-2965</key>
            <summary>maxAwaitTime not working on a change stream</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="crummel">Chris</reporter>
                        <labels>
                    </labels>
                <created>Sat, 8 Sep 2018 23:08:08 +0000</created>
                <updated>Fri, 14 Sep 2018 12:41:02 +0000</updated>
                            <resolved>Fri, 14 Sep 2018 12:41:02 +0000</resolved>
                                    <version>3.8.0</version>
                                                    <component>Query Operations</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1997644" author="jeff.yemin" created="Mon, 10 Sep 2018 12:05:46 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=crummel&quot; class=&quot;user-hover&quot; rel=&quot;crummel&quot;&gt;crummel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The driver is working as designed, though I see why it&apos;s confusing.&#160; While the &lt;em&gt;server&lt;/em&gt;&apos;s getMore command will return after &lt;tt&gt;maxAwaitTime&lt;/tt&gt; if no documents are found that match the query, the &lt;tt&gt;next&lt;/tt&gt; or &lt;tt&gt;hasNext&lt;/tt&gt; methods on &lt;tt&gt;MongoCursor&lt;/tt&gt; will not.&#160; Rather, it will continue to call the getMore command in a loop until either a document is returned, the cursor is closed, or an exception occurs.&#160; This is a consequence of the way the &lt;tt&gt;Iterator&lt;/tt&gt; interface is specified in Java.&lt;/p&gt;

&lt;p&gt;If your application requires a  time out after &lt;tt&gt;maxAwaitTime&lt;/tt&gt;, the Java driver offers the  &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.8/javadoc/index.html?com/mongodb/client/MongoCursor.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;tryNext&lt;/tt&gt;&lt;/a&gt; method on &lt;tt&gt;MongoCursor&lt;/tt&gt;. This method will return null after &lt;tt&gt;maxAwaitTime&lt;/tt&gt; if no documents were found, and can be called repeatedly by the application.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                        </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|htxztj:</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>