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

XMLWordPrintableJSON

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

      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
            Reporter:
            Greg Lincoln
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: