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

UpdateDefinitionBuilder generates incorrect Bson when using $set and multiple array subdocs

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.3
    • Component/s: Linq

      Given the following simple documents and UpdateDefinition:

      class Thing
      {
          public int Value { get; set; }
          public IList<SubThing> SubThings { get; set; }
      }
      
      class SubThing
      {
          public int SubValue { get; set; }
      }
      var ud = new UpdateDefinitionBuilder<Thing>().Set(o => o.Value, 1)
                      .Set(o => o.SubThings[0].SubValue, 0)
                      .Set(o => o.SubThings[1].SubValue, 1);
      

      I get the following incorrect BSON:
      { "$set" :

      { "Value" : 1, "SubThings.2.SubValue" : 1 }

      }

      I'm expecting:
      { "$set" : { "Value" : 1, "SubThings.0.SubValue" : 0, "SubThings.1.SubValue" : 1 }}

      This only seems to occur when using a lambda field selector.

            Assignee:
            Unassigned Unassigned
            Reporter:
            tetious Greg Lincoln
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: