<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:42:53 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-2558] Unable to determine the serialization information for decimal type with Update.Set</title>
                <link>https://jira.mongodb.org/browse/CSHARP-2558</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;With Amount defined in the class as:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;error&quot;&gt;&amp;#91;BsonIgnoreIfNull&amp;#93;&lt;/span&gt;&lt;br/&gt;
public decimal? Amount { get; set; } = null;&lt;/p&gt;

&lt;p&gt;The following update returns throws the error: One or more errors occurred. (Unable to determine the serialization information for x =&amp;gt; value(i3vDB.CollectionsTrans.Transaction).MerchantAmount.)&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160;&#160;&#160; await myCollection.UpdateOneAsync(x =&amp;gt; x.Id == id,&lt;br/&gt;
Builders&amp;lt;Transaction&amp;gt;.Update.Set(x =&amp;gt; Amount, newValue)).ConfigureAwait(false);&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I am able to use the same logic to update bools, and other data types without issues.&#160; I&apos;ve tried with and without setting the BsonSerializer to support the new decimal format:&lt;/p&gt;

&lt;p&gt;&#160;&#160;&#160; BsonSerializer.RegisterSerializer(typeof(decimal), new DecimalSerializer(BsonType.Decimal128));&lt;br/&gt;
BsonSerializer.RegisterSerializer(typeof(decimal?), new NullableSerializer&amp;lt;decimal&amp;gt;(new DecimalSerializer(BsonType.Decimal128)));&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I am able to load and save the object normally (.Find and .ReplaceOneAsync)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Full error message:&lt;/p&gt;

&lt;p&gt;System.AggregateException : One or more errors occurred. (Unable to determine the serialization information for x =&amp;gt; value(i3vDB.CollectionsTrans.Transaction).MerchantAmount.)&lt;br/&gt;
 ----&amp;gt; System.InvalidOperationException : Unable to determine the serialization information for x =&amp;gt; value(i3vDB.CollectionsTrans.Transaction).MerchantAmount.&lt;br/&gt;
 at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)&lt;br/&gt;
 at System.Threading.Tasks.Task.Wait()&lt;br/&gt;
 at Velocity.Common.Test.DynamicPayout.CalculateJournalEntries_CreditCardSale.CreditCardSale_Refund_Calculate(DateTime transactionDateTime, DateTime expectedDate) in C:\dbs\chargepayment\Blocks\Velocity\Common.Test\DynamicPayout\CalculateJournalEntries_CreditCardSale.cs:line 571&lt;br/&gt;
--InvalidOperationException&lt;br/&gt;
 at MongoDB.Driver.ExpressionFieldDefinition`2.Render(IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry, Boolean allowScalarValueForArrayField)&lt;br/&gt;
 at MongoDB.Driver.OperatorUpdateDefinition`2.Render(IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionImpl`1.ConvertWriteModelToWriteRequest(WriteModel`1 model, Int32 index)&lt;br/&gt;
 at System.Linq.Enumerable.SelectIterator&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource,TResult&amp;#93;&lt;/span&gt;(IEnumerable`1 source, Func`3 selector)+MoveNext()&lt;br/&gt;
 at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)&lt;br/&gt;
 at System.Linq.Enumerable.ToList&lt;span class=&quot;error&quot;&gt;&amp;#91;TSource&amp;#93;&lt;/span&gt;(IEnumerable`1 source)&lt;br/&gt;
 at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation..ctor(CollectionNamespace collectionNamespace, IEnumerable`1 requests, MessageEncoderSettings messageEncoderSettings)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionImpl`1.CreateBulkWriteOperation(IEnumerable`1 requests, BulkWriteOptions options)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionImpl`1.BulkWriteAsync(IClientSessionHandle session, IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync&lt;span class=&quot;error&quot;&gt;&amp;#91;TResult&amp;#93;&lt;/span&gt;(Func`2 funcAsync, CancellationToken cancellationToken)&lt;br/&gt;
 at MongoDB.Driver.MongoCollectionBase`1.UpdateOneAsync(FilterDefinition`1 filter, UpdateDefinition`1 update, UpdateOptions options, Func`3 bulkWriteAsync)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment>MongoDB version 4.0.6&lt;br/&gt;
.Core 2.2</environment>
        <key id="720811">CSHARP-2558</key>
            <summary>Unable to determine the serialization information for decimal type with Update.Set</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="wan.bachtiar@mongodb.com">Wan Bachtiar</assignee>
                                    <reporter username="tim.arheit@payschools.com">Tim Arheit</reporter>
                        <labels>
                    </labels>
                <created>Thu, 21 Mar 2019 21:19:36 +0000</created>
                <updated>Mon, 3 Apr 2023 13:27:17 +0000</updated>
                            <resolved>Thu, 25 Jun 2020 02:28:10 +0000</resolved>
                                    <version>2.8.0</version>
                                                    <component>BSON</component>
                    <component>Write Operations</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3223185" author="rachelle.palmer" created="Thu, 25 Jun 2020 02:28:10 +0000"  >&lt;p&gt;Hi there, thank you for reaching out to MongoDB. As this sounds more like a support issue, I wanted to give you some resources to get this question answered more quickly:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;our MongoDB support portal, located at &lt;a href=&quot;https://support.mongodb.com/welcome&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;support.mongodb.com&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;our MongoDB community forums, located &lt;a href=&quot;https://developer.mongodb.com/community/forums/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;If you are an Atlas customer, there is free support offered 24/7 in the lower right hand corner of the UI.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Thank you!&lt;br/&gt;
Rachelle&lt;/p&gt;</comment>
                            <comment id="2271852" author="wan.bachtiar" created="Wed, 5 Jun 2019 06:15:31 +0000"  >&lt;blockquote&gt;&lt;p&gt;I am able to use the same logic to update bools, and other data types without issues.  I&apos;ve tried with and without setting the BsonSerializer to support the new decimal format:&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Hi Tim, &lt;/p&gt;

&lt;p&gt;The update code snippet that you&apos;ve posted seems to be incorrect (typo?). The &lt;tt&gt;Amount&lt;/tt&gt; part should have been &lt;tt&gt;x.Amount&lt;/tt&gt; for the context to exist. Changing the example update line to &lt;tt&gt;x.Amount&lt;/tt&gt; works for me in v2.8.x. Please note that if you don&apos;t include the &lt;tt&gt;Decimal128&lt;/tt&gt; serialisation it will default to string.  &lt;/p&gt;

&lt;p&gt;I&apos;ve also noticed that you have another related question answered in &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-2607&quot; title=&quot;BsonDefaultValue does not accept decimals.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-2607&quot;&gt;&lt;del&gt;CSHARP-2607&lt;/del&gt;&lt;/a&gt;. If you still have further question, please provide a minimal, complete, and reproducible code snippet. &lt;/p&gt;

&lt;p&gt;Regards, &lt;br/&gt;
Wan. &lt;/p&gt;</comment>
                    </comments>
                    <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|huh2rz:</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>