<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:58:25 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-1914] Does order of keys  matter in hashes?</title>
                <link>https://jira.mongodb.org/browse/SERVER-1914</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I have this object that has an array of hashes representing addresses. &lt;/p&gt;

&lt;p&gt;See below:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.customers.find(&lt;/p&gt;
{&quot;_id&quot;:&quot;c098443ae4243643b189fc43e071a0a3&quot;}
&lt;p&gt;)             &lt;br/&gt;
{ &quot;_id&quot; : &quot;c098443ae4243643b189fc43e071a0a3&quot;, &quot;addresses&quot; : [&lt;br/&gt;
	&lt;/p&gt;
{
		&quot;address1&quot; : &quot;18 W 18th Street&quot;,
		&quot;address2&quot; : &quot;Floor 9&quot;,
		&quot;city&quot; : &quot;New York&quot;,
		&quot;companyName&quot; : &quot;The OpenSky Project&quot;,
		&quot;country&quot; : &quot;US&quot;,
		&quot;firstName&quot; : &quot;Matthew&quot;,
		&quot;lastName&quot; : &quot;Fitzgerald&quot;,
		&quot;phone&quot; : &quot;201-406-1869&quot;,
		&quot;postalCode&quot; : &quot;10016&quot;,
		&quot;slug&quot; : &quot;2fghj2x&quot;,
		&quot;state&quot; : &quot;NY&quot;,
		&quot;subtype&quot; : 2,
		&quot;type&quot; : &quot;customer&quot;
	}
&lt;p&gt;,&lt;/p&gt;
	{
		&quot;address1&quot; : &quot;101 Main Street&quot;,
		&quot;city&quot; : &quot;Middle America&quot;,
		&quot;country&quot; : &quot;us&quot;,
		&quot;firstName&quot; : &quot;Matthew&quot;,
		&quot;lastName&quot; : &quot;Fitzgerald&quot;,
		&quot;phone&quot; : &quot;201-406-1869&quot;,
		&quot;phoneExtension&quot; : &quot;111&quot;,
		&quot;postalCode&quot; : &quot;55555&quot;,
		&quot;slug&quot; : &quot;fm8x&quot;,
		&quot;state&quot; : &quot;KS&quot;,
		&quot;type&quot; : &quot;customer&quot;
	}
&lt;p&gt;] }&lt;/p&gt;

&lt;p&gt;When I attempt to remove an address using &quot;$pullAll&quot; and unordered hash it does not remove it.&lt;/p&gt;

&lt;p&gt;Ex: This fails&lt;br/&gt;
&amp;gt; db.customers.update(&lt;br/&gt;
	&lt;/p&gt;
{ &quot;_id&quot;: &quot;c098443ae4243643b189fc43e071a0a3&quot; }
&lt;p&gt;, &lt;br/&gt;
	{ &quot;$pullAll&quot;: &lt;br/&gt;
		{ &quot;addresses&quot;: &lt;br/&gt;
			[&lt;/p&gt;
				{ 
					&quot;slug&quot;: &quot;fm8x&quot;, 
					&quot;type&quot;: &quot;customer&quot;, 
					&quot;firstName&quot;: &quot;Matthew&quot;, 
					&quot;lastName&quot;: &quot;Fitzgerald&quot;, 
					&quot;address1&quot;: &quot;101 Main Street&quot;, 
					&quot;city&quot;: &quot;Middle America&quot;, 
					&quot;state&quot;: &quot;KS&quot;, 
					&quot;postalCode&quot;: &quot;55555&quot;, 
					&quot;country&quot;: &quot;us&quot;, 
					&quot;phone&quot;: &quot;201-406-1869&quot;, 
					&quot;phoneExtension&quot;: &quot;111&quot; 
				} 
&lt;p&gt;			] &lt;br/&gt;
		} &lt;br/&gt;
	}&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;Ex: This succeeds&lt;/p&gt;

&lt;p&gt;&amp;gt; db.customers.update( &lt;br/&gt;
	&lt;/p&gt;
{ &quot;_id&quot;: &quot;c098443ae4243643b189fc43e071a0a3&quot; }
&lt;p&gt;, &lt;br/&gt;
	{ &quot;$pullAll&quot;: &lt;br/&gt;
		{ &quot;addresses&quot;: &lt;br/&gt;
			[&lt;/p&gt;
				{ 
					&quot;address1&quot;: &quot;101 Main Street&quot;, 
					&quot;city&quot;: &quot;Middle America&quot;, 
					&quot;country&quot;: &quot;us&quot;,
					&quot;firstName&quot;: &quot;Matthew&quot;, 
					&quot;lastName&quot;: &quot;Fitzgerald&quot;, 			 					
					&quot;phone&quot;: &quot;201-406-1869&quot;, 
					&quot;phoneExtension&quot;: &quot;111&quot;,
					&quot;postalCode&quot;: &quot;55555&quot;,
					&quot;slug&quot;: &quot;fm8x&quot;, 
					&quot;state&quot;: &quot;KS&quot;, 
					&quot;type&quot;: &quot;customer&quot;
				} 
&lt;p&gt;			] &lt;br/&gt;
		} &lt;br/&gt;
	}&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;Question: Does the order of keys in javascript hash objects matter or is it a MongoDB specific limitation? And what are the rules for ordering of keys in hashes in MongoDB (is it alphabetical by key). Is it ordered at all?&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Matt&lt;/p&gt;</description>
                <environment></environment>
        <key id="13296">SERVER-1914</key>
            <summary>Does order of keys  matter in hashes?</summary>
                <type id="6" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14720&amp;avatarType=issuetype">Question</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="tirnanog06">Matthew Fitzgerald</reporter>
                        <labels>
                    </labels>
                <created>Fri, 8 Oct 2010 18:09:35 +0000</created>
                <updated>Wed, 4 Feb 2015 20:03:40 +0000</updated>
                            <resolved>Sun, 16 Jan 2011 06:36:48 +0000</resolved>
                                                                                        <votes>1</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="821562" author="jonathanrodan" created="Wed, 4 Feb 2015 20:03:40 +0000"  >&lt;p&gt;@eliot, correct me if I&apos;m wrong, but if I remember well, libraries like the oficial python library can modify the order of the fields in an object. Shouldn&apos;t the order be skipped to account for those cases in which the official libraries limit the users ability to use the index?&lt;/p&gt;</comment>
                            <comment id="22416" author="eliot" created="Sun, 16 Jan 2011 06:36:48 +0000"  >&lt;p&gt;BSON is ordered by design, so order does/should matter.&lt;/p&gt;</comment>
                            <comment id="19026" author="scotthernandez" created="Sat, 9 Oct 2010 00:29:46 +0000"  >&lt;p&gt;Order matters and it is the order you send them to the server in. The server does not reorder them. Matches are made by basically doing a binary compare of the bson data.&lt;/p&gt;

&lt;p&gt;Each language/driver may order them differently; some languages don&apos;t have (insert) ordered map/dict impls.&lt;/p&gt;

&lt;p&gt;BTW, It isn&apos;t a hash-map but is more an array (orderd list) of pairs (string, document) as defined by the bson spec.&lt;/p&gt;

&lt;p&gt;For you specific question, &lt;b&gt;you&lt;/b&gt; should make sure the order is the same, or use another method to remove the array values (like $elemMatch).&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 9 Oct 2010 00:29:46 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 2 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>jonathanrodan</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 2 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>jonathanrodan</customfieldvalue>
            <customfieldvalue>tirnanog06</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrpdkn:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>21880</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_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>
                                

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

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