<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:01:02 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-4020] Expose a new parameter to pass FindOptions for find operations in MongoCollection</title>
                <link>https://jira.mongodb.org/browse/JAVA-4020</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;ol&gt;
	&lt;li&gt;
	&lt;ol&gt;
		&lt;li&gt;Motivation ##&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;The constructor of&#160; com.mongodb.reactivestreams.client.internal.FindPublisherImpl#FindPublisherImpl creates a new instance of&#160;FindOptions, which is a waste of memory.&lt;/p&gt;

&lt;p&gt;And MongoCollection doesn&apos;t allow developers to pass the instance of FindOptions (while update/count/delete operations allow passing their options)&lt;/p&gt;

&lt;p&gt;We want to pass our own FindOptions instance to avoid recreating the same&#160;FindOptions instance.&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;
	&lt;ol&gt;
		&lt;li&gt;Solution ##&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;1.&#160;Expose a new parameter to pass FindOptions for find operations in MongoCollection&lt;/p&gt;

&lt;p&gt;2. Allow pass custom FindOptions to&#160;com.mongodb.reactivestreams.client.internal.FindPublisherImpl#FindPublisherImpl&lt;/p&gt;</description>
                <environment></environment>
        <key id="1630380">JAVA-4020</key>
            <summary>Expose a new parameter to pass FindOptions for find operations in MongoCollection</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="13203">Gone away</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="eurekajameschen@gmail.com">James Chen</reporter>
                        <labels>
                    </labels>
                <created>Tue, 23 Feb 2021 03:15:44 +0000</created>
                <updated>Fri, 27 Oct 2023 19:48:29 +0000</updated>
                            <resolved>Fri, 12 Mar 2021 12:00:00 +0000</resolved>
                                    <version>4.2.1</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3662529" author="backlog-server-pm" created="Fri, 12 Mar 2021 12:00:00 +0000"  >&lt;p&gt;There hasn&apos;t been any recent activity on this ticket, so we&apos;re resolving it. Thanks for reaching out! Please feel free to comment on this if you&apos;re able to provide more information.&lt;/p&gt;</comment>
                            <comment id="3631571" author="JIRAUSER1258806" created="Tue, 23 Feb 2021 23:48:39 +0000"  >&lt;p&gt;@Jeffrey Yemin, thank you for your quick reply,&lt;/p&gt;

&lt;p&gt;We don&apos;t have a plan to measure and benchmark the performance improvement currently. These tickets may be just low priority, but can be considered as an improvement to both memory and code&#160;maintainability in mongo-java-driver&#160;(the same for the ticket &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4021&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/JAVA-4021&lt;/a&gt;&#160;&#65288;Use Update/Find/Delete/...Options as a context in Find/...Operation class to avoid copying&#65289;) in future releases.&lt;/p&gt;

&lt;p&gt;And after going through the code review of mongo-java-driver, the change to&#160;allow users to pass FindOptions seems not a difficult thing and can keep code consistent with other operations in com.mongodb.reactivestreams.client.MongoCollection (they all support accept an Options parameter).&lt;/p&gt;

&lt;p&gt;About&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-4021&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/JAVA-4021&lt;/a&gt;&#160;, it can not only just avoid allocating duplicate objects but also&#160;eliminate&#160;error-prone code that redeclares all options twice (e.g. one in FindOptions and another in FindOperations) for better maintainability and code clarity.&lt;/p&gt;</comment>
                            <comment id="3631054" author="jeff.yemin" created="Tue, 23 Feb 2021 20:26:15 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=eurekajameschen%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;eurekajameschen@gmail.com&quot;&gt;eurekajameschen@gmail.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Have you been able to demonstrate that the requested change results in a measurable and significant performance improvement in either throughput or latency?  If so, we would consider it, but our experience has been that optimizations like this tend not to result in a noticeable improvement.  Consider that this is just one of many, many short-lived objects that are created as a result of a single database operation (often in the context of an HTTP request inside an application server), and getting rid of just one of those objects is not likely to improve performance significantly.&lt;/p&gt;

&lt;p&gt;Also consider that Java runtimes are now quite efficient at garbage-collecting short-lived objects.  Do you have evidence that any FindOptions instances are living long enough to be promoted to the tenured generation and require collection via a major GC collection?  If so, it&apos;s possible that tuning your garbage collector would be beneficial to your application.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <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|hyhqxb:</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>