[CSHARP-2558] Unable to determine the serialization information for decimal type with Update.Set Created: 21/Mar/19 Updated: 03/Apr/23 Resolved: 25/Jun/20 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON, Write Operations |
| Affects Version/s: | 2.8.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Tim Arheit | Assignee: | Wan Bachtiar |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
MongoDB version 4.0.6 |
||
| Description |
|
With Amount defined in the class as: [BsonIgnoreIfNull] The following update returns throws the error: One or more errors occurred. (Unable to determine the serialization information for x => value(i3vDB.CollectionsTrans.Transaction).MerchantAmount.) await myCollection.UpdateOneAsync(x => x.Id == id,
I am able to use the same logic to update bools, and other data types without issues. I've tried with and without setting the BsonSerializer to support the new decimal format: BsonSerializer.RegisterSerializer(typeof(decimal), new DecimalSerializer(BsonType.Decimal128));
I am able to load and save the object normally (.Find and .ReplaceOneAsync)
Full error message: System.AggregateException : One or more errors occurred. (Unable to determine the serialization information for x => value(i3vDB.CollectionsTrans.Transaction).MerchantAmount.)
|
| Comments |
| Comment by Rachelle Palmer [ 25/Jun/20 ] |
|
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:
Thank you! |
| Comment by Wan Bachtiar [ 05/Jun/19 ] |
Hi Tim, The update code snippet that you've posted seems to be incorrect (typo?). The Amount part should have been x.Amount for the context to exist. Changing the example update line to x.Amount works for me in v2.8.x. Please note that if you don't include the Decimal128 serialisation it will default to string. I've also noticed that you have another related question answered in Regards, |