<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 09:01:32 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-4222] Aggregation pipeline stage $out cannot be used with Atlas specific description</title>
                <link>https://jira.mongodb.org/browse/JAVA-4222</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Greetings,&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;According to the mongodb doc about $out stage (&lt;a href=&quot;https://docs.mongodb.com/datalake/reference/pipeline/out/#-out&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.com/datalake/reference/pipeline/out/#-out&lt;/a&gt;) it is possible to define out stage composed with a document which contains fields different than db and coll.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;However, in latest driver (4.2.3), it only allows to use $out stage with db and coll fields (if it is used as document). Here is the places I spotted for the error is thrown:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/0ce5c4f7977aa7a0a8a2b10b0f22477a8231dce5/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/AggregatePublisherImpl.java#L209&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/0ce5c4f7977aa7a0a8a2b10b0f22477a8231dce5/driver-reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/AggregatePublisherImpl.java#L209&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/0ce5c4f7977aa7a0a8a2b10b0f22477a8231dce5/driver-sync/src/main/com/mongodb/client/internal/AggregateIterableImpl.java#L232&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/0ce5c4f7977aa7a0a8a2b10b0f22477a8231dce5/driver-sync/src/main/com/mongodb/client/internal/AggregateIterableImpl.java#L232&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Please consider to support Atlas specific $out stage as given in the mongodb doc.&lt;/p&gt;

&lt;p&gt;Best,&lt;/p&gt;</description>
                <environment></environment>
        <key id="1809161">JAVA-4222</key>
            <summary>Aggregation pipeline stage $out cannot be used with Atlas specific description</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="13202">Works as Designed</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="alperen.pulur@3tsoftwarelabs.com">Alperen Pulur</reporter>
                        <labels>
                            <label>external-user</label>
                    </labels>
                <created>Tue, 6 Jul 2021 11:35:16 +0000</created>
                <updated>Fri, 27 Oct 2023 13:20:56 +0000</updated>
                            <resolved>Tue, 6 Jul 2021 17:07:53 +0000</resolved>
                                    <version>4.2.3</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="3918543" author="jeff.yemin" created="Tue, 6 Jul 2021 17:07:37 +0000"  >&lt;p&gt;You are right to assume that.  We don&apos;t intend to support streaming from the output collection outside of the basic support that exists.&lt;/p&gt;</comment>
                            <comment id="3918277" author="alperen.pulur@3tsoftwarelabs.com" created="Tue, 6 Jul 2021 15:44:29 +0000"  >&lt;p&gt;I see, I kinda rely on cursor at the moment to show some of the documents those are being copied into new collection. But this seems to be a very edge case maybe I need to add that extra find at the end of the operation.&lt;/p&gt;

&lt;p&gt;So in that regard, I take your response as this will not be added to the driver at any point to cover the case. Am I right to assume that? Or you may prefer to take into account that case in the future?&lt;/p&gt;</comment>
                            <comment id="3918179" author="jeff.yemin" created="Tue, 6 Jul 2021 15:20:38 +0000"  >&lt;p&gt;Yes &lt;tt&gt;toCollection()&lt;/tt&gt; is specific for $out and $merge.  If you need to iterate over that collection subsequent to the aggregation finishing, you can do so with a separate call to &lt;tt&gt;MongoCollection#find&lt;/tt&gt;&lt;/p&gt;</comment>
                            <comment id="3917871" author="alperen.pulur@3tsoftwarelabs.com" created="Tue, 6 Jul 2021 13:52:20 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=jeff.yemin&quot; class=&quot;user-hover&quot; rel=&quot;jeff.yemin&quot;&gt;jeff.yemin&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Indeed, I was using &lt;tt&gt;AggregateIterable#iterator&lt;/tt&gt;. Is use of toCollection() specific for $out and $merge? I can give a try if it works or not, but would like to understand if this is the expected way of implementing such pipelines.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="3917608" author="jeff.yemin" created="Tue, 6 Jul 2021 12:04:14 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=alperen.pulur%403tsoftwarelabs.com&quot; class=&quot;user-hover&quot; rel=&quot;alperen.pulur@3tsoftwarelabs.com&quot;&gt;alperen.pulur@3tsoftwarelabs.com&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;I suspect you&apos;re using &lt;tt&gt;AggregateIterable#cursor&lt;/tt&gt;&#160;or &lt;tt&gt;AggregateIterable#iterator&lt;/tt&gt;&#160;to initiate the aggregation. Have you tried using the&#160;&lt;tt&gt;AggregateIterable#toCollection&lt;/tt&gt; method?&#160;&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_10257" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Documentation Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11861"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hzaz33:</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>