<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:46:59 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-4027] BsonDiscriminator not always written</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4027</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;When using FindOneAndUpdate(Async) with Upsert = true and only SetOnInsert fields, BsonDiscriminator is not written.&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Pleaseprovidetheversionofthedriver.Ifapplicable%2CpleaseprovidetheMongoDBserverversionandtopology%28standalone%2Creplicaset%2Corshardedcluster%29.&quot;&gt;&lt;/a&gt;Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).&lt;/h4&gt;

&lt;p&gt;Driver 2.13.3 and 2.14.1, .NET 6&lt;/p&gt;

&lt;p&gt;Sharded Clusters 3.4.10 and 3.4.16&lt;/p&gt;

&lt;p&gt;Standalone: 5.0.5&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce&quot;&gt;&lt;/a&gt;How to Reproduce&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;See attached Zip.&lt;/em&gt;&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;em&gt;Create a Class.&lt;/em&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em&gt;Create a ClassMap. ClassMap should set discriminator name, required, root, and add known type. (see file BasicLockBlock.cs in attached Zip.)&lt;/em&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em&gt;Register ClassMap.&lt;/em&gt;&lt;/li&gt;
	&lt;li&gt;&lt;em&gt;Execute FindAndUpdate(Async) for a document that doesn&apos;t exist. Use Upsert = true to insert new document. (see file program.cs in attached Zip.)&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;h4&gt;&lt;a name=&quot;AdditionalBackground&quot;&gt;&lt;/a&gt;Additional Background&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Please provide any additional background information that may be helpful in diagnosing the bug.&lt;/em&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1974194">CSHARP-4027</key>
            <summary>BsonDiscriminator not always written</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="msimkin@bn.com">Marc Simkin</reporter>
                        <labels>
                    </labels>
                <created>Mon, 31 Jan 2022 16:41:44 +0000</created>
                <updated>Thu, 31 Mar 2022 00:23:32 +0000</updated>
                                            <version>2.14.1</version>
                    <version>2.13.3</version>
                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4374662" author="msimkin@bn.com" created="Thu, 24 Feb 2022 16:33:54 +0000"  >&lt;p&gt;@Robert Stam, I have spent some time thinking about this issue.&lt;/p&gt;

&lt;p&gt;IMO, if a NEW document is being inserted, via upsert, than the discriminator should be written.&lt;/p&gt;

&lt;p&gt;If the document is being UPDATED, if the discriminator doesn&apos;t exist (or it has a different value) it should NOT be modified.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="4330742" author="msimkin@bn.com" created="Wed, 2 Feb 2022 16:51:51 +0000"  >&lt;p&gt;Your welcome.&lt;/p&gt;

&lt;p&gt;Thank you for the work around.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="4330699" author="rstam" created="Wed, 2 Feb 2022 16:41:07 +0000"  >&lt;p&gt;Thank you for reporting this. We&apos;re thinking about what the proper behavior should be. The way upsert normally works is that it creates a new document by combining values from the filter with instructions from the update specification. This process doesn&apos;t normally involve automatically modifying the update instructions to add an additional field like the discriminator. Though maybe it should.&lt;/p&gt;

&lt;p&gt;An easy workaround in the meantime is to add the discriminator yourself:&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;   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;.SetOnInsert(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;_t&quot;&lt;/span&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;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;BasicLockBlock&quot;&lt;/span&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;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="357813" name="MongoDiscriminatorTest.zip" size="3083" author="msimkin@bn.com" created="Mon, 31 Jan 2022 16:24:38 +0000"/>
                    </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|i01pef:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>