<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:34 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>[CSHARP-691] UpdateBuilder.Set throws InvalidOperationException when Set twice with the same element.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-691</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;UpdateBuilder.Set throws InvalidOperationException when Set twice with the same element.&lt;/p&gt;

&lt;p&gt;Eg:&lt;/p&gt;

&lt;p&gt;UpdateQuerySet.Set(&quot;Email&quot;, value1);&lt;br/&gt;
UpdateQuerySet.Set(&quot;Email&quot;, value2);&lt;/p&gt;

&lt;p&gt;Ideally, it should have overwritten the first value. Or even, as a worst case, it should just add the second value along, since update({}, &lt;/p&gt;
{&quot;email&quot;: &quot;value1&quot;, &quot;email&quot; : &quot;value2&quot;}
&lt;p&gt; works on perfectly as a command when given directly using the MongoDB shell. &lt;/p&gt;</description>
                <environment>MongoDB C# Driver. </environment>
        <key id="66765">CSHARP-691</key>
            <summary>UpdateBuilder.Set throws InvalidOperationException when Set twice with the same element.</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="prasannavl">Prasanna V. Loganathar</reporter>
                        <labels>
                    </labels>
                <created>Thu, 28 Feb 2013 08:33:34 +0000</created>
                <updated>Thu, 6 Oct 2016 17:12:04 +0000</updated>
                            <resolved>Thu, 6 Oct 2016 17:12:04 +0000</resolved>
                                    <version>1.7.1</version>
                                    <fixVersion>2.0</fixVersion>
                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="1402167" author="rstam" created="Thu, 6 Oct 2016 17:09:42 +0000"  >&lt;p&gt;The UpdateBuilder in the 1.x driver uses the rule that a duplicate Set throws an exception.&lt;/p&gt;

&lt;p&gt;The new UpdateDefinitionBuilder in the 2.x driver uses the rule that the last Set wins.&lt;/p&gt;

&lt;p&gt;At this point we should just leave the 1.x API alone, and since the the 2.x builder no longer throws an exception I&apos;m going to close this as Fixed in 2.0.&lt;/p&gt;</comment>
                            <comment id="351780" author="sridhar" created="Mon, 3 Jun 2013 18:19:05 +0000"  >&lt;p&gt;Note the server does not allow multiple modifiers on the same field&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;&amp;gt; db.foo.find()&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; : 1 }&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; : 2, &quot;v&quot; : 2 }&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; &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;&amp;gt; db.foo.update({_id:2}, {$set:{v:1},$inc:{v:1}})&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;Field name duplication not allowed with modifiers&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 driver will not allow setting the same element twice. Having said that we will change the exception thrown to be ArgumentException. This is more in tune with .Net throwing ArgumentException on a duplicate on Dictionary.Add &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/k7z0zy8k.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://msdn.microsoft.com/en-us/library/k7z0zy8k.aspx&lt;/a&gt;. &lt;/p&gt;</comment>
                            <comment id="350341" author="sridhar" created="Sat, 1 Jun 2013 00:22:14 +0000"  >&lt;p&gt;As far as what the shell does is that it basically takes the last value. In your example email would be value 2. This is same behavior you see in some of the other drivers such as PHP and Ruby and this is because what you are passing in is an array/hash/dictionary. Here the repeated key just results in the last value being taken. &lt;br/&gt;
Since we are dealing with a higher level API here we are being explicit about the semantic&lt;/p&gt;</comment>
                            <comment id="337244" author="craiggwilson" created="Thu, 16 May 2013 16:52:11 +0000"  >&lt;p&gt;Perhaps a better exception type is all that is necessary?  DuplicateKeyException or something?&lt;/p&gt;

&lt;p&gt;I don&apos;t think adding the key to the document twice is a good option.  So that leaves us with two options:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;Overwrite the original value&lt;/li&gt;
	&lt;li&gt;Throw an exception&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Overwriting a value could easily lead to bugs in your application that could be very difficult to track down. &quot;I&apos;ve set the value of Email to XXX very explicitly here, yet it is getting set to YYY&quot; would be the common complaint.  Whereas, when we throw the exception, you know very specifically where that is happeneing and can take action to mitigate very easily.&lt;/p&gt;

&lt;p&gt;If you feel strongly about this, then please write back and give us your thoughts.  For now, I&apos;m going to mark this for a fix in 1.9 to change the exception getting thrown.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="39411">CSHARP-474</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="107481">CSHARP-902</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </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|hsme5j:</customfieldvalue>

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