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

Consider adding conversion logic into a generated Project query for Aggregate when it's necessary

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.14.0
    • Affects Version/s: None
    • Component/s: Linq, LINQ3
    • Labels:
      None

      This ticket is related to the user's question in CSHARP-2908.

      Currently, this projection logic:

      var resultProject = collection
      .Aggregate()
      .Project(
      	el => new { DividedPopulation = ((el.Population / 23))            
      })
      .ToList();
      

      will fail with FormatException, because we're trying to convert a double field from server response to int. We need to consider a convert top-level json node to the generated request, for example, to something like this (added `$toInt`):

      { $toInt : { $divide : [ ... ] } }
      

      It's possible that this ticket will be implemented in the scope of LINQ redesign ticket CSHARP-2608

            Assignee:
            Unassigned Unassigned
            Reporter:
            dmitry.lukyanov@mongodb.com Dmitry Lukyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: