Skip to content

Typed tables, cannot run update operations that set map columns to empty #168

@sl-at-ibm

Description

@sl-at-ibm

Neither for typed nor for untyped can one run an update that sets a (non-string-keyed) map column to the empty map. Doing so results in the wrong serialization as [] instead of the required {}.

This affects:

Typed update via a dictionary, i.e.

            var mapIntStr_Typed_Empty = new Dictionary<int, string> { };

            var updateTyped_Empty = Builders<SBook>
              .TableUpdate.Set(b => b.MapColumnIntStr, mapIntStr_Typed_Empty);

            await table.UpdateOneAsync(filterUpd_Typed, updateTyped_Empty);

Untyped update via dictionary, i.e.

            var mapIntStr_Untyped_Empty = new Dictionary<int, string> { };

            var updateUntyped_Empty = Builders<Row>
              .TableUpdate.Set("map_column_int_str", mapIntStr_Untyped_Empty);

            await untypedTable.UpdateOneAsync(filterUpd_Untyped, updateUntyped_Empty);

_Note: this also happens for untyped updates done with a new List<object[]> { }, but those don't seem that they can be healed elegantly.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions