-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.1
-
Component/s: None
-
None
-
Environment:Windows Server 2008
-
Minor Change
Using the code below, if a call is made to class method Handle() with an evnt with out any Changes this will pass an initialized but empty UpdateBuilder() to the MongoCollection Update command which will null out all the values in the document. I was expecting no changes to be made.
public class xyz
{
readonly MongoCollection<T> _docs;
public void Update(dynamic id, IMongoUpdate update)
{ _docs.Update(new QueryDocument("_id", id), update); }}
public class abc
{
readonly xyz _atttributeTypes;
public void Handle(AttributeTypeUpdated evnt)
{ var update = new UpdateBuilder(); foreach (var change in evnt.Changes) update.SetWrapped(change.Key, change.Value); _atttributeTypes.Update(evnt.EventSourceId, update); }}