Support the $ positional operator when building a query for updating a collection

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Done
    • Priority: Major - P3
    • 2.0
    • Affects Version/s: 1.5
    • Component/s: Feature Request
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The feature to add strongly typed LINQ support to the builders doesn't suppport updating of nested collections.

      For example, it's possible to write an update like:

      statusCollection.Update(
      Query<StatusGroup>.Where(sg => sg.Statuses.Any(s => s.Id == status.Id)),
      Update.Set("Statuses.$.UpdateTime", DateTime.Now)
      .Set("Statuses.$.Name", "name")
      );

      It would be nice if it was possible to write something like:

      statusCollection.Update(
      Query<StatusGroup>.Where(sg => sg.Statuses.Any(s => s.Id == status.Id)),
      Update<StatusGroup, Status>.Set(sg => sg.Statuses, s => s.UpdateTime, DateTime.Now)
      .Set(sg => sg.Statuses, s => s.Name, "name")
      );

      Eventually it would be nice to support multi-level nested collections but that might be dependant on https://jira.mongodb.org/browse/SERVER-831

              Assignee:
              Unassigned
              Reporter:
              Seb Michaud
              Votes:
              18 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: