<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:19 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-451] About closing of cursors</title>
                <link>https://jira.mongodb.org/browse/JAVA-451</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Given: a new cursor via a find on a collection&lt;br/&gt;
If: the cursor is closed before any documents are fetched&lt;br/&gt;
And: the sort order is changed&lt;br/&gt;
Then: No exception is thrown&lt;/p&gt;

&lt;p&gt;Is this a bug? I expect that an exception should be thrown if one changes the sort or limit etc on a closed cursor.&lt;/p&gt;</description>
                <environment>jruby 1.6.4</environment>
        <key id="23749">JAVA-451</key>
            <summary>About closing of cursors</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="guyboertje">Guy Boertje</reporter>
                        <labels>
                            <label>cursor</label>
                    </labels>
                <created>Tue, 18 Oct 2011 12:29:15 +0000</created>
                <updated>Wed, 11 Sep 2019 19:12:53 +0000</updated>
                            <resolved>Thu, 22 Sep 2016 13:00:13 +0000</resolved>
                                    <version>2.6.5</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1390723" author="jeff.yemin" created="Thu, 22 Sep 2016 12:59:52 +0000"  >&lt;p&gt;As DBCursor is effectively deprecated now, we don&apos;t plan to make any further changes in its behavior.  The new CRUD API defined in &lt;a href=&quot;https://api.mongodb.com/java/3.2/com/mongodb/client/MongoCollection.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoCollection&lt;/a&gt; does not suffer from this design issue.&lt;/p&gt;</comment>
                            <comment id="61202" author="guyboertje" created="Tue, 18 Oct 2011 18:27:41 +0000"  >&lt;p&gt;Sorry I need to be less assuming.  This is my understanding.&lt;/p&gt;

&lt;p&gt;When the cursor is created the private var _it is null.&lt;br/&gt;
If the cursor is never used - only setOptions called, then&lt;br/&gt;
the cursor is closed - as _it is null and not an instance of Result nothing is done (no state change).&lt;br/&gt;
Then if sort, skip, or limit is called, as _it is still null an IllegalStateException would not be thrown.&lt;/p&gt;

&lt;p&gt;AFAIK the java tests dont cover this.  In trying to make JMongo API compatible with the ruby driver which does have a test for this, the test failed.  Now I know that this may be being over zealous of the ruby driver and I have to make a judgement call on whether to stick hard an fast to the API or skip the test.&lt;/p&gt;

&lt;p&gt;It seems weird, in the case described above, to be able to use the cursor after it been closed, or maybe I am missing something.&lt;/p&gt;</comment>
                            <comment id="61179" author="antoine" created="Tue, 18 Oct 2011 17:39:32 +0000"  >&lt;p&gt;In any case no documents can be fetched anymore.&lt;br/&gt;
Changing limit / sort is done client side since no document was ever fetched.&lt;br/&gt;
driver could throw an exception but it doesnt seem important to any app?&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|hrhbmf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14683</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>