<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:30:21 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>[SERVER-53249] $addToSet changes the sequence while $push maintains array sequence</title>
                <link>https://jira.mongodb.org/browse/SERVER-53249</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;While using group function of aggregation, the $addToSet for an array randomizes the sequence.&lt;/p&gt;

&lt;p&gt;Where as $push keeps the sequence as it is.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1560299">SERVER-53249</key>
            <summary>$addToSet changes the sequence while $push maintains array sequence</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="edwin.zhou@mongodb.com">Edwin Zhou</assignee>
                                    <reporter username="sudarshan.chavan@travelxp.tv">Sudarshan Chavan</reporter>
                        <labels>
                    </labels>
                <created>Sat, 5 Dec 2020 07:19:06 +0000</created>
                <updated>Fri, 27 Oct 2023 13:52:34 +0000</updated>
                            <resolved>Wed, 9 Dec 2020 20:34:31 +0000</resolved>
                                    <version>4.2.11</version>
                                                    <component>Aggregation Framework</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="3523765" author="JIRAUSER1257066" created="Wed, 9 Dec 2020 20:34:31 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=sudarshan.chavan%40travelxp.tv&quot; class=&quot;user-hover&quot; rel=&quot;sudarshan.chavan@travelxp.tv&quot;&gt;sudarshan.chavan@travelxp.tv&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;The behavior you observed&#160;with &lt;tt&gt;$addToSet&lt;/tt&gt; is intended. &lt;a href=&quot;https://docs.mongodb.com/manual/reference/operator/update/addToSet/index.html#behavior&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;$addToSet&lt;/tt&gt; does not guarantee a particular ordering of elements in the modified set.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is also noted in the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/operator/aggregation/addToSet/index.html#definition&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;$addToSet&lt;/tt&gt; aggregation stage&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You should continue to use &lt;tt&gt;$push&lt;/tt&gt; if you wish to preserve the order.&lt;/p&gt;

&lt;p&gt;All the best,&lt;br/&gt;
 Edwin&lt;/p&gt;</comment>
                            <comment id="3517400" author="JIRAUSER1257869" created="Sat, 5 Dec 2020 07:20:25 +0000"  >&lt;p&gt;The sequence should remain same while using addToSet&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="290229" name="aggregation pipeline addtoset and push.txt" size="8269" author="sudarshan.chavan@travelxp.tv" created="Sat, 5 Dec 2020 07:19:03 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 9 Dec 2020 17:29:27 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 9 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></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_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 9 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>edwin.zhou@mongodb.com</customfieldvalue>
            <customfieldvalue>sudarshan.chavan@travelxp.tv</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hykh1j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hy6dfb:</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>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Here&apos;s the following example.&lt;/p&gt;

&lt;p&gt;unwind&lt;/p&gt;

{
 path: &apos;$data&apos;,
 includeArrayIndex: &apos;index&apos;,
 preserveNullAndEmptyArrays: true
}

&lt;p&gt;sort&lt;/p&gt;
{
 &quot;_id&quot;: 1
}

&lt;p&gt;where _id are sequence of numbers 1,2,3,4 etc&lt;/p&gt;

&lt;p&gt;group&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
 _id:&quot;$id&quot;,&#160; //$id is objectid&lt;br/&gt;
 title: &lt;/p&gt;
{
 $first: &apos;$title&apos;
 }
&lt;p&gt;,&lt;br/&gt;
 description: &lt;/p&gt;
{
 $first: &apos;$description&apos;
 }
&lt;p&gt;,&lt;br/&gt;
 episode:&lt;/p&gt;
{
 $first:&apos;$episode&apos;
 
 }
&lt;p&gt;,&lt;br/&gt;
 seasons: &lt;/p&gt;
{
 $first: &apos;$seasons&apos;
 }
&lt;p&gt;,&lt;br/&gt;
 episodes:&lt;/p&gt;
{
 $first:&quot;$episodes&quot;
 }
&lt;p&gt;,&lt;br/&gt;
 dur: &lt;/p&gt;
{
 $first: &apos;$dur&apos;
 }
&lt;p&gt;,&lt;br/&gt;
 &quot;4k&quot;: &lt;/p&gt;
{
 $first: &apos;$4k&apos;
 }
&lt;p&gt;,&lt;br/&gt;
 hlghdr: &lt;/p&gt;
{
 $first: &apos;$hlghdr&apos;
 }
&lt;p&gt;,&lt;br/&gt;
 progress:{$first:null},&lt;br/&gt;
 image:&lt;/p&gt;
{
 $first:&quot;$image&quot;
 }
&lt;p&gt;,&lt;br/&gt;
 watchlist:&lt;/p&gt;
{
 $first:&quot;$watchlist&quot;
 }
&lt;p&gt;,&lt;br/&gt;
 type: &lt;/p&gt;
{
 $first: &apos;$type&apos;
 }
&lt;p&gt;,&lt;/p&gt;

&lt;p&gt; data: &lt;/p&gt;
{
 $push: &apos;$data&apos;&#160; /// &amp;lt;- here the sequence gets changed when using addToSet
 }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                    <customfieldvalue><![CDATA[edwin.zhou@mongodb.com]]></customfieldvalue>
    

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hyk3av:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>