[CSHARP-3100] Updating non-null dictionary field with null doesn`t work Created: 10/May/20  Updated: 27/Oct/23  Resolved: 15/Jun/20

Status: Closed
Project: C# Driver
Component/s: Serialization
Affects Version/s: 2.10.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Aleksandr N/A Assignee: Unassigned
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

.Net Core 3.1



 Description   

I have such field in Document

[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
public Dictionary<LinkAt<AdvertType>, decimal> AdvertisementTypeAndPrice { get; set; }

LinkAt is Document too

now this field is not null, exactly it has 3 keyvalue pairs

but when i try to do this code
acc.AudienceGroupPercentage = null;
acc.Save();

 

it doesnt saves. No exeption, but if i am trying to get this object another one time, i get the start value with 3 keyvalue pairs.

 

Found this issue in google, but it is not related to C# and mongo driver exactly, but may be helpfull
https://github.com/doctrine/mongodb-odm/issues/1671



 Comments   
Comment by Esha Bhargava [ 15/Jun/20 ]

Since we haven't heard back from you, we are closing this ticket. If you want to discuss this further, please post on the MongoDB Community Forums.

Comment by Jeffrey Yemin [ 19/May/20 ]

Hi a.pchelkin32@gmail.com

It doesn't have to be your production code. We're just asking for a small test case that demonstrates the issue.

Comment by Aleksandr N/A [ 19/May/20 ]

Unfortunately i can`t because it is commercial development and i will be punished for such an action.

Comment by Esha Bhargava [ 18/May/20 ]

a.pchelkin32@gmail.com Can you provide us with a full working example?

Comment by Aleksandr N/A [ 10/May/20 ]

>acc.AudienceGroupPercentage = null; is not correct
>acc.AdvertisementTypeAndPrice = null; of course

 

didnt find where to change the body

Generated at Wed Feb 07 21:44:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.