<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:38:09 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-902] UpdateBuilder.Set should overwrite value if called twice with the same field</title>
                <link>https://jira.mongodb.org/browse/CSHARP-902</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Refer StackOverflow question (&lt;a href=&quot;http://stackoverflow.com/q/21227428/30007&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/q/21227428/30007&lt;/a&gt;) for detailed description. The answer to that question also suggests a workaround in the meanwhile. &lt;br/&gt;
----------&lt;/p&gt;

&lt;p&gt;var update = new UpdateBuilder&amp;lt;SomeClass&amp;gt;();&lt;br/&gt;
update.Set(x =&amp;gt; x.Prop1, value1);&lt;br/&gt;
update.Set(x =&amp;gt; x.Prop2, value2);&lt;br/&gt;
update.Set(x =&amp;gt; x.Prop1, anotherValue1); // this throws a Duplicate element name error. It should overwrite the value of Prop1 with anotherValue1. &lt;/p&gt;


</description>
                <environment></environment>
        <key id="107481">CSHARP-902</key>
            <summary>UpdateBuilder.Set should overwrite value if called twice with the same field</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="amithgeorge">Amith George</reporter>
                        <labels>
                    </labels>
                <created>Fri, 24 Jan 2014 11:53:16 +0000</created>
                <updated>Thu, 20 Mar 2014 14:37:57 +0000</updated>
                            <resolved>Fri, 24 Jan 2014 17:30:35 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="487381" author="rstam" created="Fri, 24 Jan 2014 17:30:35 +0000"  >&lt;p&gt;See original ticket &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-691&quot; title=&quot;UpdateBuilder.Set throws InvalidOperationException when Set twice with the same element.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-691&quot;&gt;&lt;del&gt;CSHARP-691&lt;/del&gt;&lt;/a&gt; instead.&lt;/p&gt;</comment>
                            <comment id="487377" author="rstam" created="Fri, 24 Jan 2014 17:28:26 +0000"  >&lt;p&gt;This ticket is a duplicate. Linking to the original ticket and resolving this one.&lt;/p&gt;</comment>
                            <comment id="487235" author="rstam" created="Fri, 24 Jan 2014 15:17:27 +0000"  >&lt;p&gt;The server only allows one update operator per field. The current implementation of the Update builder makes no attempt to enforce this (perhaps it should?). If you apply multiple &lt;b&gt;different&lt;/b&gt; update operators to the same field you will get an error server side. If you apply the &lt;b&gt;same&lt;/b&gt; update operator (in your case Set) to the same field you get an exception client side, as a side effect of BsonDocument not allowing duplicate element names.&lt;/p&gt;

&lt;p&gt;So the options here are:&lt;/p&gt;

&lt;p&gt;1. Allow Set to be called multiple times (and last one wins)&lt;br/&gt;
2. Enforce client side the same restrictions the server does&lt;/p&gt;

&lt;p&gt;Either way, whatever solution is adopted should be generalized to all update operators, not just Set.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="66765">CSHARP-691</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|hrvlun:</customfieldvalue>

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