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

Using GetType in Group throws instead of translating to _t

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor - P4 Minor - P4
    • None
    • 2.2
    • Linq
    • None

    Description

      There's no to use Group (and probably other aggregations) with anonymous types to generate a projection for the discriminator (i.e. _t).

      For example this works:

      collection.Aggregate.Group(x => new { Name = x.Name }, g => new { Count = g.Count() }
      

      But grouping on the document type:

      collection.Aggregate.Group(x => new { Type = x.GetType }, g => new { Count = g.Count() }
      

      throws an exception with the following message:

      GetType of type System.Object is not supported in the expression tree document.GetType()

      Attachments

        Activity

          People

            Unassigned Unassigned
            I3arnon Bar Arnon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: