<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:54:40 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-1458] Aggregation problem with Enterprise version</title>
                <link>https://jira.mongodb.org/browse/JAVA-1458</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;We are getting an error on our new enterprise server that does not appear on the open source version.  We use the same code but change the pointer to the servers.  Both servers are MongodB 2.6.4. &lt;/p&gt;

&lt;p&gt;We are using Spring Data 1.6.0-RELEASE to load the MongoDB java driver.&lt;br/&gt;
When we execute an aggregation using only the $out operation we see using only the $out operator to copy the collection, we get an error (below).  Here is the code:&lt;br/&gt;
        // Get the collection&lt;br/&gt;
        DBCollection sourceCollection = mongoOperations.getCollection(sourceCollectionName);&lt;br/&gt;
        // Set up a pipeline&lt;br/&gt;
        List&amp;lt;DBObject&amp;gt; ops = new ArrayList&amp;lt;DBObject&amp;gt;();&lt;br/&gt;
        // Write to the target collection&lt;br/&gt;
        ops.add(new BasicDBObject(&quot;$out&quot;, targetCollectionName));&lt;br/&gt;
        // Do the copy&lt;br/&gt;
        sourceCollection.aggregate(ops);&lt;/p&gt;

&lt;p&gt;When the code runs, it makes sure the target collection does not exist.&lt;/p&gt;

&lt;p&gt;Here is the important part of the error:&lt;/p&gt;

&lt;p&gt;Caused by: java.lang.IllegalArgumentException: result undefined &lt;br/&gt;
at com.mongodb.AggregationOutput.&amp;lt;init&amp;gt;(AggregationOutput.java:80) &lt;br/&gt;
at com.mongodb.DBCollection.aggregate(DBCollection.java:1554) &lt;br/&gt;
at com.mongodb.DBCollection.aggregate(DBCollection.java:1532) &lt;br/&gt;
at com.bankofamerica.risk.aml.lms.service.ListService.copyCollection(ListService.java:978) &lt;/p&gt;

</description>
                <environment>RHEL 5.9 (open source) and 6.4 (enterprise server)</environment>
        <key id="159156">JAVA-1458</key>
            <summary>Aggregation problem with Enterprise version</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="michael.gozaloff@bankofamerica.com">Mike Gozaloff</reporter>
                        <labels>
                            <label>aggregation</label>
                            <label>java</label>
                            <label>spring</label>
                    </labels>
                <created>Fri, 19 Sep 2014 13:51:22 +0000</created>
                <updated>Wed, 11 Sep 2019 19:11:31 +0000</updated>
                            <resolved>Sat, 4 Oct 2014 02:51:57 +0000</resolved>
                                    <version>2.12.3</version>
                                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="734149" author="jeff.yemin" created="Sat, 4 Oct 2014 02:51:57 +0000"  >&lt;p&gt;Closing this as a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-1253&quot; title=&quot;AggregationOutput should not throw IllegalArgumentException on command failure&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-1253&quot;&gt;&lt;del&gt;JAVA-1253&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="723066" author="marcelo.rocha@10gen.com" created="Fri, 19 Sep 2014 15:18:46 +0000"  >&lt;p&gt;Gozer,&lt;/p&gt;

&lt;p&gt;The best way to be sure of the best performance outcome is to benchmark it.&lt;/p&gt;

&lt;p&gt;When using RDBMSs, as you know, dropping the indexes during a batch load is a smart performance optimization trick.&lt;/p&gt;

&lt;p&gt;With MongoDB, typically I would expect you to gain a &quot;small&quot; performance benefit by creating the indexes after the table has been loaded.  The performance gain by doing that  is certainly much less significant than what you see in a &quot;legacy&quot; RDBMS.&lt;/p&gt;</comment>
                            <comment id="723053" author="michael.gozaloff@bankofamerica.com" created="Fri, 19 Sep 2014 15:01:48 +0000"  >&lt;p&gt;It looks like it works when doing the aggregation from the client. &lt;/p&gt;

&lt;p&gt;We can try your code next.&lt;/p&gt;

&lt;p&gt;On a similar note...  When doing an aggregation to copy a collection, is it better/faster to have an empty collection with indexes already in place or should we copy the documents into a new collection then apply the indexes after?&lt;/p&gt;

&lt;p&gt;Thanks,&lt;/p&gt;

&lt;p&gt;gozer&lt;/p&gt;</comment>
                            <comment id="723007" author="jeff.yemin" created="Fri, 19 Sep 2014 14:41:33 +0000"  >&lt;p&gt;I&apos;m not sure yet why enterprise server would return different results, but I think you&apos;ll be able to work around this by using this DBCollection method instead:&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;    Cursor aggregate(&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;final&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; List&amp;lt;DBObject&amp;gt; pipeline, AggregationOptions options)&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;This method has explicit handing for $out and will return a lazy cursor on the output collection.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="137565">JAVA-1253</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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|hs2den:</customfieldvalue>

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