<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:00:22 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-3758] Improve the support for mapped find iterables</title>
                <link>https://jira.mongodb.org/browse/JAVA-3758</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Currently, when calling FindIterable#map, the API will only return a MongoIterable, limiting the options to further adjust the cursor after mapping it like in the following example:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;MongoClient client = MongoClients.create();&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;MongoDatabase database = client.getDatabase(&quot;abc&quot;);&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;MongoCollection&amp;lt;Document&amp;gt; collection = database.getCollection(&quot;collection&quot;);&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;FindIterable&amp;lt;Document&amp;gt; iterable = collection.find();&lt;/tt&gt;&lt;br/&gt;
&lt;tt&gt;MongoIterable&amp;lt;String&amp;gt; mappedIterable = iterable.map(Document::toJson);&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;The resulting MongoIterable now does not provide useful FindIterable methods like FindIterable#limit, FindIterable#sort and so on. I have opened up a Pull-Request for this feature on GitHub: &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/551&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/551&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1375386">JAVA-3758</key>
            <summary>Improve the support for mapped find iterables</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="mail@moritz-hennen.de">Moritz Hennen</reporter>
                        <labels>
                    </labels>
                <created>Mon, 8 Jun 2020 23:09:21 +0000</created>
                <updated>Tue, 4 Aug 2020 03:23:14 +0000</updated>
                            <resolved>Tue, 4 Aug 2020 03:23:14 +0000</resolved>
                                    <version>4.0.4</version>
                                                    <component>API</component>
                    <component>Query Operations</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3318927" author="jeff.yemin" created="Tue, 4 Aug 2020 03:23:14 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mail%40moritz-hennen.de&quot; class=&quot;user-hover&quot; rel=&quot;mail@moritz-hennen.de&quot;&gt;mail@moritz-hennen.de&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;We&apos;ve decided not to pursue this change until we get signal that it will be useful to a wide group of users. We can reconsider if there are more requests for it.&lt;/p&gt;

&lt;p&gt;Closing as Won&apos;t Fix. &lt;/p&gt;</comment>
                            <comment id="3288449" author="JIRAUSER1253272" created="Thu, 16 Jul 2020 17:36:00 +0000"  >&lt;p&gt;Hi @Jeffrey Yemin,&lt;/p&gt;

&lt;p&gt;my map function is &lt;br/&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;MongoStatsReader::&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (Document -&amp;gt; MongoStatsReader)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt; (&lt;a href=&quot;https://github.com/KitPvPDE/stats-api/blob/master/src/main/java/net/kitpvp/pluginapi/modules/stats/mongo/MongoStatsReader.java&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/KitPvPDE/stats-api/blob/master/src/main/java/net/kitpvp/pluginapi/modules/stats/mongo/MongoStatsReader.java&lt;/a&gt;),&lt;/p&gt;

&lt;p&gt;and the stats reader class is defined here: &lt;a href=&quot;https://github.com/KitPvPDE/stats-api/blob/ae45ae5cf757914315687741e41511e01f667d8f/src/main/java/net/kitpvp/pluginapi/modules/stats/StatsReader.java#L15&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/KitPvPDE/stats-api/blob/ae45ae5cf757914315687741e41511e01f667d8f/src/main/java/net/kitpvp/pluginapi/modules/stats/StatsReader.java#L15&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3288141" author="jeff.yemin" created="Thu, 16 Jul 2020 15:25:52 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mail%40moritz-hennen.de&quot; class=&quot;user-hover&quot; rel=&quot;mail@moritz-hennen.de&quot;&gt;mail@moritz-hennen.de&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Can you share your map function and the StatsReader class?  It&apos;s possible that the built-in PojoCodecProvider will just work out of the box.  Note that these map functions were added before we had native support for decoding to POJOs.  &lt;/p&gt;</comment>
                            <comment id="3287822" author="JIRAUSER1253272" created="Thu, 16 Jul 2020 13:20:45 +0000"  >&lt;p&gt;Hi @Jeffrey Yemin&lt;/p&gt;

&lt;p&gt;I developed a simple stats API for saving and loading stats per document, and therefor added a class for find operations. It implements java.lang.Iterable&amp;lt;StatsReader&amp;gt; and the iterator() Method specified by the java.lang.Iterable interface. Currently, because the map method is expected to be used as the last method in the chain, I have to map the existing FindIterable&amp;lt;Document&amp;gt; to the required MongoIterable&amp;lt;StatsReader&amp;gt; just as any method like FindQuery#find, FindQuery#findOne or FindQuery#iterator gets called. ((&lt;a href=&quot;https://github.com/KitPvPDE/stats-api/blob/ae45ae5cf757914315687741e41511e01f667d8f/src/main/java/net/kitpvp/pluginapi/modules/stats/mongo/queries/FindQuery.java#L16&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/KitPvPDE/stats-api/blob/ae45ae5cf757914315687741e41511e01f667d8f/src/main/java/net/kitpvp/pluginapi/modules/stats/mongo/queries/FindQuery.java#L16&lt;/a&gt;)&lt;br/&gt;
) Wouldnt it be easier to already have a FindIterable&amp;lt;StatsReader&amp;gt; (or such similar) to directly proxy those methods to? &lt;/p&gt;

&lt;p&gt;I thought about using MongoDatabase#getCollection(name, StatsReader.class), but there I cannot specify a map function as the class parameter gets used for decoding by codec &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/help_16.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="3281109" author="jeff.yemin" created="Sat, 11 Jul 2020 15:24:49 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=mail%40moritz-hennen.de&quot; class=&quot;user-hover&quot; rel=&quot;mail@moritz-hennen.de&quot;&gt;mail@moritz-hennen.de&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was done intentionally, with the assumption that applications could apply the map as the last method in the chain, e.g.&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;collection.find().limit(&lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;).sort(Sorts.ascending(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;x&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;).map(Document::toJson)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Can you give a scenario or use case showing why that&apos;s not practical for you?&lt;/p&gt;

&lt;p&gt;Also, if we are going to do this for FindIterable, we will have to do it for all other sub-types of MongoIterable, for sync, reactive streams, and Scala APIs.&lt;/p&gt;
</comment>
                            <comment id="3206078" author="JIRAUSER1253272" created="Thu, 11 Jun 2020 21:11:15 +0000"  >&lt;p&gt;Update:&lt;/p&gt;

&lt;p&gt;Removed the old pull request and submitted a new one, since the old one didnt pass the build test. Submitted a new one, which compiles cleanly.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/pull/553&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/pull/553&lt;/a&gt;&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|hxc58n:</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>