<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:35:35 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>[CSHARP-24] Make Cursors reusable</title>
                <link>https://jira.mongodb.org/browse/CSHARP-24</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Using some of the Linq extensions like Count() will exhaust the cursor and cause unpredictable behavior if it is then used in a foreach loop.&lt;/p&gt;</description>
                <environment></environment>
        <key id="11466">CSHARP-24</key>
            <summary>Make Cursors reusable</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="9">Done</resolution>
                                        <assignee username="lanwin">Steve Wagner</assignee>
                                    <reporter username="sam">Sam Corder</reporter>
                        <labels>
                    </labels>
                <created>Tue, 9 Mar 2010 13:49:13 +0000</created>
                <updated>Wed, 19 Oct 2016 22:38:40 +0000</updated>
                            <resolved>Fri, 14 May 2010 07:44:45 +0000</resolved>
                                                                                        <votes>2</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="14255" author="lanwin" created="Fri, 14 May 2010 07:44:45 +0000"  >&lt;p&gt;Fixed for next stable version. Development code can be found here. &lt;a href=&quot;http://github.com/lanwin/mongodb-csharp/tree/typedcollections&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://github.com/lanwin/mongodb-csharp/tree/typedcollections&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="14071" author="serge.knecht" created="Wed, 5 May 2010 13:46:34 +0000"  >&lt;p&gt;Problem summary:&lt;br/&gt;
When a query is performed a cursor is returned. In some cases when iterating through the cursor 2 times the 2nd time not all all documents are returned. Therefore the cursor.Documents from a cursor can only be used once in its lifetime.&lt;/p&gt;

&lt;p&gt;Example : First time the following is done. cursor.Documents.Count() will return 677.&lt;br/&gt;
The 2nd and next times the same method is invoked on the same cursor instance cursor.Documents.Count() will return for example 511.&lt;/p&gt;

&lt;p&gt;Reason:&lt;br/&gt;
when we iterate through the cursor.Documents the retrieval can be doen in several chunks (maybe because the data is in different physical files ?).&lt;br/&gt;
The first time upon entering the et from public IEnumerable&amp;lt;Document&amp;gt; Documents the is.reply  == null and the method RetrieveData(); will be called. &lt;br/&gt;
This retrieves the first chunk of the dataset.&lt;br/&gt;
The remaining data (chuncks of data) will be retrieved using RetrieveMoreData();&lt;/p&gt;

&lt;p&gt;BUG:&lt;br/&gt;
when the program now iterates a 2nd time this iteration by calling the cursor.Documents ... not the full dataset is returned.&lt;br/&gt;
This is because upon entering the get from public IEnumerable&amp;lt;Document&amp;gt; Documents the 2nd time this.reply is no longer NULL. &lt;br/&gt;
It contains the reply from the previous iteration.&lt;br/&gt;
Therefor RetrieveData(); is NOT run ... and only RetrieveMoreData(); is run ... &lt;br/&gt;
as a consequence it&apos;s only returning the documents from the last &apos;chunk&apos;.&lt;/p&gt;

&lt;p&gt;Suggestion to fix:&lt;br/&gt;
Probably the test on this.reply == null is done as a performance improvement however in this case it has an unwanted problem.&lt;br/&gt;
When iterating through the documents there should be a proper reset of its state or ... maybe simply remove the test on this.reply ? or ... ?&lt;/p&gt;
</comment>
                            <comment id="13553" author="lanwin" created="Mon, 12 Apr 2010 13:41:45 +0000"  >&lt;p&gt;What exactly that means?&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|hrha5j:</customfieldvalue>

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