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

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Linq
    • Labels:
      None

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              dmitry.lukyanov Dmitry Lukyanov
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: