Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-311

New serialization format for Dictionary<TKey, TValue> as array of nested documents

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.3
    • Affects Version/s: 1.1
    • Component/s: None
    • None

      Currently Dictionary<TKey, TValue> is serialized as one of two forms:

      1. A document where the element names are the dictionary key values (only possible when TKey is string)
      2. An array of nested two-element arrays containing key value pairs

      The second representation is perfectly adequate for serialization/deserialization, but it is difficult to query against. To better support querying the following alternate representation is proposed:

      { 'dictionary' : [

      { 'k' : key1, 'v' : value1 }

      , ...] }

      This representation uses a nested document for the key/value pairs instead of a nested two-element array. This facilitates querying against either the keys or the values.

      There should also be a serialization option to allow the developer to choose the second representation even when TKey is string.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: