<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:22:39 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>[DRIVERS-948] Support singleBatch option in newer drivers</title>
                <link>https://jira.mongodb.org/browse/DRIVERS-948</link>
                <project id="10980" key="DRIVERS">Drivers</project>
                    <description>&lt;p&gt;The crud spec currently omits the &lt;tt&gt;singleBatch&lt;/tt&gt; option from FindOptions in favor of the legacy negative &lt;tt&gt;limit&lt;/tt&gt; behavior used with pre 3.2 servers. See the second to last question in the &lt;a href=&quot;https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#q-a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Q&amp;amp;A section&lt;/a&gt; for more info and justification.&lt;/p&gt;

&lt;p&gt;Newer drivers (e.g. Swift and Rust) never supported this legacy behavior in the first place, so it may make sense for them to just support the &lt;tt&gt;singleBatch&lt;/tt&gt; option directly and only accept unsigned limits instead. It would lead to a minor API difference between newer drivers and the old ones, but that difference would exist in the name of simplicity and clarity, so I&apos;m not sure how much of a concern it is. &lt;/p&gt;</description>
                <environment></environment>
        <key id="1111341">DRIVERS-948</key>
            <summary>Support singleBatch option in newer drivers</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="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="12300">Won&apos;t Do</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="patrick.freed@mongodb.com">Patrick Freed</reporter>
                        <labels>
                    </labels>
                <created>Thu, 23 Jan 2020 19:18:30 +0000</created>
                <updated>Tue, 31 Mar 2020 15:41:47 +0000</updated>
                            <resolved>Tue, 31 Mar 2020 15:41:47 +0000</resolved>
                                                        <component>CRUD</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="3013641" author="jeff.yemin" created="Mon, 30 Mar 2020 18:56:59 +0000"  >&lt;p&gt;&lt;tt&gt;limit&lt;/tt&gt; should be non-negative.&lt;/p&gt;</comment>
                            <comment id="2763273" author="patrick.freed" created="Fri, 24 Jan 2020 20:41:51 +0000"  >&lt;blockquote&gt;&lt;p&gt;FWIW,&#160;&lt;tt&gt;batchSize&lt;/tt&gt;&#160;would be redundant in this case and you also shouldn&apos;t need&#160;&lt;tt&gt;singleBatch&lt;/tt&gt;. A&#160;&lt;tt&gt;limit&lt;/tt&gt;&#160;of one should be sufficient to instruct the server to select one document and immediately close the cursor.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Good point, noted.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Feel free to use it internally for findOne, just don&apos;t expose the singleBatch option in the public API.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;And for&#160;&lt;tt&gt;limit&lt;/tt&gt;&#160;on regular find, just support non-negative values?&lt;/p&gt;</comment>
                            <comment id="2762698" author="jmikola@gmail.com" created="Fri, 24 Jan 2020 18:13:13 +0000"  >&lt;blockquote&gt;&lt;p&gt;I was primarily interested in it for implementing a findOne helper, but that can be achieved with just limit: 1 and batchSize: 1.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;FWIW, &lt;tt&gt;batchSize&lt;/tt&gt; would be redundant in this case and you also shouldn&apos;t need &lt;tt&gt;singleBatch&lt;/tt&gt;. A &lt;tt&gt;limit&lt;/tt&gt; of one should be sufficient to instruct the server to select one document and immediately close the cursor.&lt;/p&gt;</comment>
                            <comment id="2762414" author="behackett" created="Fri, 24 Jan 2020 17:12:57 +0000"  >&lt;p&gt;Feel free to use it internally for findOne, just don&apos;t expose the singleBatch option in the public API.&lt;/p&gt;</comment>
                            <comment id="2762298" author="patrick.freed" created="Fri, 24 Jan 2020 16:57:35 +0000"  >&lt;p&gt;I was primarily interested in it for implementing a &lt;tt&gt;findOne&lt;/tt&gt; helper, but that can be achieved with just&#160;&lt;tt&gt;limit: 1&lt;/tt&gt;&#160;and &lt;tt&gt;batchSize: 1&lt;/tt&gt;. That said, if a user doesn&apos;t know how many documents are in a collection but they do know that they want to minimize round trips to the server, &lt;tt&gt;singleBatch: true&lt;/tt&gt; could be useful. I&apos;m not sure how common that case is, though.&#160;&lt;/p&gt;</comment>
                            <comment id="2757448" author="behackett" created="Fri, 24 Jan 2020 01:07:52 +0000"  >&lt;p&gt;Before we do such a thing I think we need to understand use cases for single batch. IIRC, we added single batch so drivers could continue to offer negative limit support (i.e. we were avoiding a backward breaking change), but I don&apos;t recall ever hearing why negative limit support was important.&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|hw8n47:</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>