<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:52:14 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-416] Using an Array to create a DBObject breaks .equals and .hashcode</title>
                <link>https://jira.mongodb.org/browse/JAVA-416</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Using a Java Array to store information in a DBObject breaks .equals and .hashcode:&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;   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;scala&amp;gt; val one = MongoDBObject(&quot;anarray&quot; -&amp;gt; Array(MongoDBObject(&quot;one&quot; -&amp;gt; &quot;oneval&quot;),MongoDBObject(&quot;two&quot;-&amp;gt;&quot;twoval&quot;)))&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;one: com.mongodb.casbah.commons.Imports.DBObject = { &quot;anarray&quot; : [ { &quot;one&quot; : &quot;oneval&quot;} , { &quot;two&quot; : &quot;twoval&quot;}]}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;scala&amp;gt; val two = MongoDBObject(&quot;anarray&quot; -&amp;gt; Array(MongoDBObject(&quot;one&quot; -&amp;gt; &quot;oneval&quot;),MongoDBObject(&quot;two&quot;-&amp;gt;&quot;twoval&quot;)))&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;two: com.mongodb.casbah.commons.Imports.DBObject = { &quot;anarray&quot; : [ { &quot;one&quot; : &quot;oneval&quot;} , { &quot;two&quot; : &quot;twoval&quot;}]}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;scala&amp;gt; one == two&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;res16: Boolean = false&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;Using a List to store the equivalent object does not:&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;   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;scala&amp;gt; val three = MongoDBObject(&quot;anarray&quot; -&amp;gt; List(MongoDBObject(&quot;one&quot; -&amp;gt; &quot;oneval&quot;),MongoDBObject(&quot;two&quot;-&amp;gt;&quot;twoval&quot;)))&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;three: com.mongodb.casbah.commons.Imports.DBObject = { &quot;anarray&quot; : [ { &quot;one&quot; : &quot;oneval&quot;} , { &quot;two&quot; : &quot;twoval&quot;}]}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;scala&amp;gt; val four = MongoDBObject(&quot;anarray&quot; -&amp;gt; List(MongoDBObject(&quot;one&quot; -&amp;gt; &quot;oneval&quot;),MongoDBObject(&quot;two&quot;-&amp;gt;&quot;twoval&quot;)))&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;four: com.mongodb.casbah.commons.Imports.DBObject = { &quot;anarray&quot; : [ { &quot;one&quot; : &quot;oneval&quot;} , { &quot;two&quot; : &quot;twoval&quot;}]}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;scala&amp;gt; three == four&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;res17: Boolean = true&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;Of course, the two objects are absolutely equal whether they are constructed with an Array or a List:&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;   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;scala&amp;gt; mongoCollection += one&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;res18: com.mongodb.WriteResult = N/A&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;scala&amp;gt; mongoCollection += three&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;res19: com.mongodb.WriteResult = N/A&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;scala&amp;gt; mongoCollection.find().foreach(println)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;4e3723614206a091d3e32a4c&quot;} , &quot;anarray&quot; : [ { &quot;one&quot; : &quot;oneval&quot;} , { &quot;two&quot; : &quot;twoval&quot;}]}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;{ &quot;_id&quot; : { &quot;$oid&quot; : &quot;4e37236e4206a091d3e32a4d&quot;} , &quot;anarray&quot; : [ { &quot;one&quot; : &quot;oneval&quot;} , { &quot;two&quot; : &quot;twoval&quot;}]}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;scala&amp;gt; val recs = mongoCollection.find().toArray&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;recs: Array[com.mongodb.casbah.Imports.DBObject] = Array({ &quot;_id&quot; : { &quot;$oid&quot; : &quot;4e3723614206a091d3e32a4c&quot;} , &quot;anarray&quot; : [ { &quot;one&quot; : &quot;oneval&quot;} , { &quot;two&quot; : &quot;twoval&quot;}]}, { &quot;_id&quot; : { &quot;$oid&quot; : &quot;4e37236e4206a091d3e32a4d&quot;} , &quot;anarray&quot; : [ { &quot;one&quot; : &quot;oneval&quot;} , { &quot;two&quot; : &quot;twoval&quot;}]})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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;   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;scala&amp;gt; recs(0).get(&quot;anarray&quot;) == recs(1).get(&quot;anarray&quot;)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;res24: Boolean = true&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;The fix should just be to store any collection that will end up as a BSON array internally as a java List.&lt;/p&gt;</description>
                <environment>All Java</environment>
        <key id="21067">JAVA-416</key>
            <summary>Using an Array to create a DBObject breaks .equals and .hashcode</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="9">Done</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="bhudgeons">Brandon Hudgeons</reporter>
                        <labels>
                    </labels>
                <created>Tue, 16 Aug 2011 16:51:33 +0000</created>
                <updated>Thu, 3 Apr 2014 15:21:37 +0000</updated>
                            <resolved>Thu, 23 Jan 2014 00:51:50 +0000</resolved>
                                    <version>2.6.5</version>
                                    <fixVersion>2.12.0</fixVersion>
                    <fixVersion>3.0.0</fixVersion>
                                    <component>API</component>
                                        <votes>1</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="506382" author="g-r-t" created="Thu, 27 Feb 2014 15:46:54 +0000"  >&lt;p&gt;Worked fine for me!&lt;/p&gt;

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

&lt;p&gt;Graham.&lt;/p&gt;



</comment>
                            <comment id="506329" author="jeff.yemin" created="Thu, 27 Feb 2014 14:51:33 +0000"  >&lt;p&gt;Hi there,&lt;/p&gt;

&lt;p&gt;Interested parties can test the fix with 2.12.0-rc0, available either on &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/releases/tag/r2.12.0-rc0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;github&lt;/a&gt; or &lt;a href=&quot;http://central.maven.org/maven2/org/mongodb/mongo-java-driver/2.12.0-rc0/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Maven Central&lt;/a&gt;.  Any takers?&lt;/p&gt;


&lt;p&gt;Thanks,&lt;br/&gt;
Jeff&lt;/p&gt;</comment>
                            <comment id="486202" author="jeff.yemin" created="Thu, 23 Jan 2014 00:51:50 +0000"  >&lt;p&gt;Fixed this in a fairly general way.  Instead of trying to check equality correctly for every possible type, the equals method instead encodes both documents as BSON and checks the equality of the byte arrays.&lt;/p&gt;

&lt;p&gt;The hashCode method, to fulfill its contract, takes the hash of the encoded BSON.&lt;/p&gt;</comment>
                            <comment id="486200" author="xgen-internal-githook" created="Thu, 23 Jan 2014 00:49:26 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-416&quot; title=&quot;Using an Array to create a DBObject breaks .equals and .hashcode&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-416&quot;&gt;&lt;del&gt;JAVA-416&lt;/del&gt;&lt;/a&gt;: Use serialized form of a document with lexicographically-sorted keys for equals and hashCode&lt;br/&gt;
Branch: 3.0.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/759bb15140751f5f26ae5270799cb4eb79af13a3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/759bb15140751f5f26ae5270799cb4eb79af13a3&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="486130" author="xgen-internal-githook" created="Wed, 22 Jan 2014 23:06:32 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-416&quot; title=&quot;Using an Array to create a DBObject breaks .equals and .hashcode&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-416&quot;&gt;&lt;del&gt;JAVA-416&lt;/del&gt;&lt;/a&gt;: Use serialized form of a document with lexicographically-sorted keys for equals and hashCode&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/8e972b271bf5fd270aee82cc98d0982c57784e7d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/8e972b271bf5fd270aee82cc98d0982c57784e7d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="50093" author="oliver.gierke" created="Tue, 23 Aug 2011 09:49:43 +0000"  >&lt;p&gt;You&apos;re right. But currently arrays cannot be used at all if you rely on equals and hashCode.&lt;/p&gt;</comment>
                            <comment id="49976" author="bhudgeons" created="Mon, 22 Aug 2011 20:11:36 +0000"  >&lt;p&gt;Oliver, that would work if both dbObjects held arrays.  (What you suggest still should be done, but it doesn&apos;t fix the specific problem we&apos;re talking about.)&lt;/p&gt;

&lt;p&gt;We want &lt;/p&gt;

&lt;p&gt;dbObject1.put(&quot;key&quot;, anArray);&lt;br/&gt;
dbObject2.put(&quot;key&quot;, aList);&lt;/p&gt;

&lt;p&gt;dbObject1.equals(dbObject2); // iff anArray and aList hold the same items&lt;/p&gt;</comment>
                            <comment id="49737" author="oliver.gierke" created="Sun, 21 Aug 2011 11:39:53 +0000"  >&lt;p&gt;For the Java side of things this can easily be fixed by using &lt;tt&gt;Arrays.equals(left, right)&lt;/tt&gt;. the &lt;tt&gt;equals(&#8230;)&lt;/tt&gt; methods simply needs another if clause. The {hasCode()}} method should be adapted as well.&lt;/p&gt;</comment>
                            <comment id="49533" author="bhudgeons" created="Fri, 19 Aug 2011 17:12:18 +0000"  >&lt;p&gt;I&apos;m rethinking this now ... maybe the best thing to do is to leave the Java driver as-is.  If you use Java, you have to deal with some unfortunate type nonsense (like Int(1) != Long(1)).  In Scala, there is all kinds of precedent for engineering == and ## to mask the underlying Java ugliness (like 1 == 1L).  Probably best just to fix it there.&lt;/p&gt;</comment>
                            <comment id="49356" author="bhudgeons" created="Thu, 18 Aug 2011 20:06:00 +0000"  >&lt;p&gt;BasicDBObject descends from java.util.AbstractMap, so you&apos;d expect &lt;/p&gt;

&lt;p&gt;dbObject.put(&quot;key&quot;,x);&lt;br/&gt;
assert(x.equals(dbObject.get(&quot;key&quot;)));&lt;/p&gt;

&lt;p&gt;This is, of course, inconsistent with the desire to have two dbObjects compare as equal if they would be represented by an equivalent document in mongodb but were created with different object types.  &lt;/p&gt;

&lt;p&gt;Two ways I see to address the issue: &lt;/p&gt;

&lt;p&gt;1.  make a well-documented exception to the above Map interface expectations when the value is a collection.  Any time you put a collection value of any type, it will be stored as a DBList.  This wouldn&apos;t break any explicit interface requirement (since BasicDBObject descends from LinkedHashMap&amp;lt;String,Object&amp;gt;), and I can&apos;t imagine that many, if any, clients need an explicit return type for collection values after they are stored and before they are saved/retrieved.  &lt;br/&gt;
2.  transform any collection value to a DBList for the purposes of .equals and .hashcode on the dbObject (maybe implement by lazily computing and caching the collection hashcode), but still return the original Object on .get.&lt;/p&gt;

&lt;p&gt;If you did #2, the only difference between a user-created dbObject and a driver-created dbObject would be what you get back on a .get(&quot;collectionkey&quot;).  If you did #1, there&apos;d be no difference (at least in this case). &lt;/p&gt;

&lt;p&gt;I&apos;d be happy to take a crack at either.&lt;/p&gt;
</comment>
                            <comment id="48856" author="brendan" created="Tue, 16 Aug 2011 17:01:26 +0000"  >&lt;p&gt;This may pose a more complex issue ... &lt;/p&gt;

&lt;p&gt;Comparing two dbObjects.  If it was created on the userspace side and not saved to MongoDB yet, the Array is likely to be represented as an Array primitive.&lt;/p&gt;

&lt;p&gt;But once it has been sent to MongoDB and retrieved from there it will be represented as a DBList.&lt;/p&gt;

&lt;p&gt;These two things should probably compare as equal.&lt;/p&gt;

&lt;p&gt;What if they use a java.util.List or something else, as well?!&lt;/p&gt;</comment>
                            <comment id="48855" author="brendan" created="Tue, 16 Aug 2011 16:52:49 +0000"  >&lt;p&gt;The bug was reported with Scala sample code originally but it is an issue for both Java and Scala users.&lt;/p&gt;

&lt;p&gt;I&apos;m going to create a scala side fix for SCALA-42, and backport a Java version as well against this bug.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="26006">JAVA-482</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="107314">JAVA-1090</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="111095">JAVA-1112</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="26006">JAVA-482</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrt6av:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>84104</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="82">Sprint 3</customfieldvalue>

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